Reputation: 19138
I'm migrating my build system over to gulp, and have encountered a problem:
I have defined various build tasks (scripts
, style
, jade
, etc), as well as a clean
task that removes all of the built files.
I want to make sure that the build tasks don't run before the clean tasks, BUT I also want to be able to run the build tasks without cleaning first.
i.e. I want:
gulp.task('build', ['clean', 'scripts', 'style', 'jade']);
To only start running scripts
, style
and jade
after clean
has finished, but
gulp.task('watch', function(){
gulp.watch('path/to/stylus', ['css']);
});
Should not trigger clean
to be run, which would be the case if css
had a dependency on clean
.
Upvotes: 4
Views: 326
Reputation: 16659
I've faced the same problem:
...
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
Please, read:
This is intended to be a temporary solution until orchestrator is updated to support non-dependent ordered tasks.
BTW, thanks https://stackoverflow.com/users/145185/overzealous!
Upvotes: 2