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) {
|
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,
|
|
|
|
};
|