mustache-express.js
function handleFile(name, file, options, cache, callback) {
	var cachedData;
	if(!options || !options.settings || options.settings['view cache'] !== false) {
		cachedData = cache && cache.get(file);
	}
	if (!cachedData) {
		loadFile(file, function(err, fileData) {
			if (err) {
				return callback(err);
			}

			var partials;
			try {
				partials = findPartials(fileData);
			} catch (err) {
				return callback(err);
			}

			var data = {
				name: name,
				data: fileData,
				partials: partials
			};
			if (cache) {
				cache.set(file, data);
			}
			return callback(null, data);
		});
	}
	else {
		return callback(null, cachedData);
	}
}
function handleFile(name, file, options, cache, callback) {
	var cachedData;
	if(!options || !options.settings || options.settings['view cache'] !== false) {
		cachedData = cache && cache.get(file);
	}
	if (!cachedData) {
		loadFile(file, function(err, fileData) {
			if (err) {
				return callback(err);
			}

			var partials;
			try {
				partials = findPartials(fileData);
			} catch (err) {
				return callback(err);
			}

			var data = {
				name: name,
				data: fileData,
				partials: partials
			};
			if (cache) {
				cache.set(file, data);
			}
			return callback(null, data);
		});
	}
	else {
		return callback(null, cachedData);
	}
}
function handleFile ( name , file , options , cache , callback ) { var cachedData ; if ( ! options || ! options . settings || options . settings [ 'view cache' ] !== false ) { cachedData = cache && cache . get ( file ) ; } if ( ! cachedData ) { loadFile ( file , function ( err , fileData ) { if ( err ) { return callback ( err ) ; } var partials ; try { partials = findPartials ( fileData ) ; } catch ( err ) { return callback ( err ) ; } var data = { name : name , data : fileData , partials : partials } ; if ( cache ) { cache . set ( file , data ) ; } return callback ( null , data ) ; } ) ; } else { return callback ( null , cachedData ) ; } }
Load a file, find it's partials, and return the relevant data.
Load a file find it s partials and return the relevant data .