-
Notifications
You must be signed in to change notification settings - Fork 40
[case]Prefabricated default plugin
王集鹄 edited this page Aug 4, 2015
·
1 revision
通常预制插件都是不断添加或移除,怎么才能不修代码就完成插件的预制?可以借助 glob 和一个模板引擎完成。
var colors = require('colors/safe');
/*<remove>*/
var defaultProcessors = {
"ejs": require('../processor/processor-ejs'),
"glob": require('../processor/processor-glob'),
"jhtmls": require('../processor/processor-jhtmls'),
};
/*</remove>*/
/*<jdists encoding="glob" pattern="../processor/*.js" export="#processors" />*/
/*<jdists encoding="jhtmls" data="#processors">
var path = require('path');
!#{'var defaultProcessors = {'}
forEach(function (process) {
"!#{path.basename(process, '.js').replace(/^processor-/, '')}": require('#{process.replace(/\.js$/, '')}'),
});
!#{'};'}
</jdists>*/
var colors = require('colors/safe');
var defaultProcessors = {
"aaencode": require('../processor/processor-aaencode'),
"autoprefixer": require('../processor/processor-autoprefixer'),
"base64": require('../processor/processor-base64'),
"candy": require('../processor/processor-candy'),
"clean-css": require('../processor/processor-clean-css'),
"ejs": require('../processor/processor-ejs'),
"glob": require('../processor/processor-glob'),
"html": require('../processor/processor-html'),
"indent": require('../processor/processor-indent'),
"jade": require('../processor/processor-jade'),
"jhtmls": require('../processor/processor-jhtmls'),
"jjencode": require('../processor/processor-jjencode'),
"jsdev": require('../processor/processor-jsdev'),
"less": require('../processor/processor-less'),
"md5": require('../processor/processor-md5'),
"quoted": require('../processor/processor-quoted'),
"regex": require('../processor/processor-regex'),
"slice": require('../processor/processor-slice'),
"svgo": require('../processor/processor-svgo'),
"trim": require('../processor/processor-trim'),
"uglify": require('../processor/processor-uglify'),
"url": require('../processor/processor-url'),
"yml2json": require('../processor/processor-yml2json'),
"zero": require('../processor/processor-zero'),
};