58 lines
1.2 KiB
JavaScript
58 lines
1.2 KiB
JavaScript
'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,
|
|
};
|