我正在将构建系统迁移到 gulp,并且遇到了一个问题:
我定义了各种构建任务(scripts
, style
, jade
等),以及clean
删除所有构建文件的任务。
我想确保构建任务不会在清理任务之前运行,BUT我还希望能够在不先清理的情况下运行构建任务。
即我想要:
gulp.task('build', ['clean', 'scripts', 'style', 'jade']);
仅开始运行scripts
, style
and jade
after clean
已经完成了,但是
gulp.task('watch', function(){
gulp.watch('path/to/stylus', ['css']);
});
不应该触发clean
要运行,如果是这样的话css
依赖于clean
.
我也遇到过同样的问题:
...
var sequence = require('run-sequence');
gulp.task('dev', ['css', 'js', 'html']);
gulp.task('watch', function() {
gulp.watch(src.css, ['css']);
gulp.watch(src.js, ['js']);
gulp.watch(src.html, ['html']);
});
gulp.task('default', function(done) {
sequence('clean', 'dev', 'watch', done);
});
https://www.npmjs.org/package/run-sequence https://www.npmjs.org/package/run-sequence
请阅读:
这是一个临时解决方案,直到 Orchestrator 更新为支持非依赖有序任务。
顺便说一句,谢谢https://stackoverflow.com/users/145185/overzealous https://stackoverflow.com/users/145185/overzealous!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)