I have looked all over the documentation and NPM to try to find a solution to this, but I have had no luck. I would like to have the option to skip the tasks that I list as dependencies when running a specific task. For example, if I have the following:
gulp.task('prerun', function(){
// do cleaning, installation, etc.
});
gulp.task('run', ['prerun'], function(){
// do stuff
});
gulp.task('watch', function(){
gulp.watch('glob/glob/**', ['run']);
});
I would like to be able to have my gulp.watch
execute run
without having to touch the overhead involved in prerun
. Is this at all possible in Gulp?
What's about a helper task? I use this approach to eliminate any dependencies in my watch tasks. Your example can look like this:
gulp.task('prerun', function(){
// do cleaning, installation, etc.
});
gulp.task('run', ['prerun'], function(){
gulp.start('run-dev');
});
gulp.task('run-dev', function() {
// do the run stuff
});
gulp.task('watch', function(){
gulp.watch('glob/glob/**', ['run-dev']);
});
The prerun task you can also use as dependency for your watch task if needed:
gulp.task('watch', ['prerun'], function(){
gulp.watch('glob/glob/**', ['run-dev']);
});
Ciao
Ralf
Without using gulp.start
, you can try this:
gulp.task('prerun', function(){
// do cleaning, installation, etc.
});
// run all dependencies while keeping run-dev as a separate task
gulp.task('run', ['prerun', 'run-dev']);
gulp.task('run-dev', function() {
// do the run stuff
});
gulp.task('watch', ['run'], function(){
gulp.watch('glob/glob/**', ['run-dev']);
});