提交 e87a8785 编写于 作者: C Catouse

* change gulp watch task.

上级 e7ccc87f
......@@ -440,17 +440,7 @@ gulp.task('build', function(callback) {
}, type);
});
['dist', 'doc', 'theme', 'lib'].forEach(function(name) {
var depsTasks = (name == 'dist' || name == 'doc') ? ['minJSON'] : [];
gulp.task(name, depsTasks, function(callback) {
console.log(' BEGIN >> ' + (' Build ' + name.bold + ' ').inverse);
buildBundle(name == 'lib' ? 'seperate' : name, function() {
console.log(' END >> ' + (' Build ' + name.bold + ' completed. ').green.inverse);
callback();
});
});
gulp.task('watch:' + name, function() {
function startWatchSrc(name) {
if(name === 'lib') name = 'seperate';
gulp.watch(["./src/less/**/*"], function(event) {
buildBundle(name, function() {
......@@ -470,6 +460,26 @@ gulp.task('build', function(callback) {
console.log(''.green + (' WATCH ' + name.bold + ' COMPLETED. ').yellow.inverse);
}, 'resource');
});
}
gulp.task('watch', function(callback) {
var name = process.argv[3] || 'dist';
if(name && name[0] === '-') name = name.substr(1);
startWatchSrc(name);
});
['dist', 'doc', 'theme', 'lib'].forEach(function(name) {
var depsTasks = (name == 'dist' || name == 'doc') ? ['minJSON'] : [];
gulp.task(name, depsTasks, function(callback) {
console.log(' BEGIN >> ' + (' Build ' + name.bold + ' ').inverse);
buildBundle(name == 'lib' ? 'seperate' : name, function() {
console.log(' END >> ' + (' Build ' + name.bold + ' completed. ').green.inverse);
callback();
});
});
gulp.task('watch:' + name, function() {
startWatchSrc(name);
});
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册