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

58 lines
1.2 KiB
JavaScript
Raw Permalink 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,
2015-02-27 00:25:57 +00:00
assemblerCreate: null,
assemblerFill: null,
2015-02-27 00:25:57 +00:00
},
css: {
configCreate: null,
configFill: null,
2015-02-27 00:25:57 +00:00
assemblerCreate: null,
assemblerFill: null,
2015-02-27 00:25:57 +00:00
},
},
};
function checkConfig(config,callback) {
if (!config) {
callback(new Error('no config'));
}
// TODO: add more
callback();
}
function fillDefaults(config,callback) {
if (config.buildOrder === undefined) {
2015-02-27 14:19:34 +00:00
config.buildOrder = template.buildOrder;
2015-02-27 00:25:57 +00:00
}
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,
};