Optimize workflow
This commit is contained in:
1 parent
cec28fc0f3
commit
1f18052940
14 files changed
+11765
-451
No files matched your search
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
*
|
||||
* @authors Tony.Deng (dengtongyu123@163.com)
|
||||
* @date 2018-05-15 15:45:22
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
const chalk = require('chalk');
|
||||
//const util = require('./util');
|
||||
|
||||
|
||||
exports.init = (pathConfig,gulp) => {
|
||||
//let pathConfig = util.getPathConfig();
|
||||
|
||||
let watchList = [{
|
||||
watchPath: pathConfig.styleBuildPath,
|
||||
taskName: ['stylus_build'],
|
||||
taskPath: 'styleChangePath'
|
||||
}, {
|
||||
watchPath: pathConfig.htmlBuildPath,
|
||||
taskName: ['html_build'],
|
||||
taskPath: 'swigChangePath'
|
||||
}, {
|
||||
watchPath: pathConfig.htmlminBuildPath,
|
||||
taskName: ['htmlmin_build'],
|
||||
taskPath: 'htmlminChangePath'
|
||||
}, {
|
||||
watchPath: pathConfig.scriptBuildPath,
|
||||
taskName: ['js_build'],
|
||||
taskPath: 'scriptChangePath'
|
||||
}, {
|
||||
watchPath: pathConfig.uglifyBuildPath,
|
||||
taskName: ['uglify_build'],
|
||||
taskPath: 'uglifyChangePath'
|
||||
}, {
|
||||
watchPath: pathConfig.tmodBuildPath,
|
||||
taskName: ['tmodjs_build'],
|
||||
taskPath: 'tmodChangePath'
|
||||
}];
|
||||
|
||||
for (var i = 0; i < watchList.length; i++) {
|
||||
if (watchList[i].taskName[0] == 'uglify_build' || watchList[i].taskName[0] == 'htmlmin_build') continue;
|
||||
|
||||
gulp.watch(watchList[i].watchPath, watchList[i].taskName).on('change', function(event) {
|
||||
//let fileType = util.pathType(event.path);
|
||||
//pathConfig[watchList[fileType].taskPath] = path.relative(__dirname, event.path);
|
||||
//added为新增,deleted为删除,changed为改变
|
||||
//变化类型 和 变化的文件的路径
|
||||
console.log(chalk.green(event.type + ' : ' + event.path));
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user