2
0
Fork 0
node-ff-assets/lib/assets-builder-config.js

58 lines
1.2 KiB
JavaScript
Raw Normal View History

2015-02-27 00:25:57 +00:00
'use strict';
var factory = require('./factory');
var template = {
buildOrder: ['css','js'],
configCreate: null,
configFill: factory.builder.configCreate.nop(),
assemblerCreate: factory.builder.assemblerCreate.readFile(),
assemblerFill: factory.builder.configCreate.nop(),
assets: {
js: {
configCreate: null,
configFill: null,
assemblerCreate: null,
assemblerFill: null,
},
css: {
configCreate: null,
configFill: null,
assemblerCreate: null,
assemblerFill: null,
},
},
};
function checkConfig(config,callback) {
if (!config) {
callback(new Error('no config'));
}
// TODO: add more
callback();
}
function fillDefaults(config,callback) {
if (config.buildOrder === undefined) {
config.buildOrder = Object.keys(config.assets);
}
if (config.configFill === undefined) {
config.configFill = template.configFill;
}
if (config.assemblerCreate === undefined) {
config.assemblerCreate = template.assemblerCreate;
}
if (config.assemblerFill === undefined) {
config.assemblerFill = template.assemblerFill;
}
callback();
}
module.exports = {
template: template,
checkConfig: checkConfig,
fillDefaults: fillDefaults,
};