lib/resources/FileResource.js
function FileResource( pkg, config ) {
	var key,
		resource = this,
		dir = pkg.getDirectory(),
		cfg = { files: [] };

	// Normalize configuration
	if ( typeof config === 'string' ) {
		cfg.files.push( config );
	} else if ( Array.isArray( config ) ) {
		cfg.files = cfg.files.concat( config );
	} else {
		for ( key in config ) {
			if ( key === 'file' || key === 'files' ) {
				cfg.files = cfg.files.concat(
					Array.isArray( config[key] ) ? config[key] : [ config[key] ]
				);
			} else {
				cfg[key] = config[key];
			}
		}
	}
	cfg.files = cfg.files.map( function ( file ) {
		return path.join( dir, file );
	} );

	// Parent constructor
	FileResource.super.call( this, pkg, cfg );

	// Properties
	this.versionGenerator = function *() {
		return yield ay( cfg.files )
			.reduce( resource.reduceFileToMaximumModifiedTime, 1 );
	};
	this.contentGenerator = function *( options ) {
		return yield ay( cfg.files )
			.map( function *( file ) {
				return yield resource.mapFileToContent( file, options );
			} )
			.reduce( resource.reduceContentToConcatenatedContent, '' );
	};
}
function FileResource( pkg, config ) {
	var key,
		resource = this,
		dir = pkg.getDirectory(),
		cfg = { files: [] };

	// Normalize configuration
	if ( typeof config === 'string' ) {
		cfg.files.push( config );
	} else if ( Array.isArray( config ) ) {
		cfg.files = cfg.files.concat( config );
	} else {
		for ( key in config ) {
			if ( key === 'file' || key === 'files' ) {
				cfg.files = cfg.files.concat(
					Array.isArray( config[key] ) ? config[key] : [ config[key] ]
				);
			} else {
				cfg[key] = config[key];
			}
		}
	}
	cfg.files = cfg.files.map( function ( file ) {
		return path.join( dir, file );
	} );

	// Parent constructor
	FileResource.super.call( this, pkg, cfg );

	// Properties
	this.versionGenerator = function *() {
		return yield ay( cfg.files )
			.reduce( resource.reduceFileToMaximumModifiedTime, 1 );
	};
	this.contentGenerator = function *( options ) {
		return yield ay( cfg.files )
			.map( function *( file ) {
				return yield resource.mapFileToContent( file, options );
			} )
			.reduce( resource.reduceContentToConcatenatedContent, '' );
	};
}
function FileResource ( pkg , config ) { var key , resource = this , dir = pkg . getDirectory ( ) , cfg = { files : [ ] } ; // Normalize configuration if ( typeof config === 'string' ) { cfg . files . push ( config ) ; } else if ( Array . isArray ( config ) ) { cfg . files = cfg . files . concat ( config ) ; } else { for ( key in config ) { if ( key === 'file' || key === 'files' ) { cfg . files = cfg . files . concat ( Array . isArray ( config [ key ] ) ? config [ key ] : [ config [ key ] ] ) ; } else { cfg [ key ] = config [ key ] ; } } } cfg . files = cfg . files . map ( function ( file ) { return path . join ( dir , file ) ; } ) ; // Parent constructor FileResource . super . call ( this , pkg , cfg ) ; // Properties this . versionGenerator = function * ( ) { return yield ay ( cfg . files ) . reduce ( resource . reduceFileToMaximumModifiedTime , 1 ) ; } ; this . contentGenerator = function * ( options ) { return yield ay ( cfg . files ) . map ( function * ( file ) { return yield resource . mapFileToContent ( file , options ) ; } ) . reduce ( resource . reduceContentToConcatenatedContent , '' ) ; } ; }
File resource.

Resources can be configured with either a string, an array of strings, or an object with a `file`
or `files` properties, each a string or array of strings. The normalized configuration will
never have a `file` property and always have a `files` property which is an array of file paths.
If the configuration is an object, all properties other than `file` and `files` will be passed
through without modification.

@class
@extends {Resource}

@constructor
@param {Package} pkg Package this resource is part of
@param {Object|string[]|string} config Resource configuration or one or more resource file paths
@param {string|string[]} [config.file] One or more resource file paths
@param {string|string[]} [config.files] One or more resource file paths
File resource .