Gulp: synchronization without dependence

I port my build system to gulp and run into a problem:

I have identified a variety of assembly tasks ( scripts, style, jadeetc.), as well as a task cleanthat removes all embedded files.

I want to make sure that the build tasks are not performed before the clean tasks, BUT . I also want to be able to run build tasks without cleaning first.

i.e. I want to:

gulp.task('build', ['clean', 'scripts', 'style', 'jade']);

To run only scripts, styleand jadeafter completion clean, but

gulp.task('watch', function(){

  gulp.watch('path/to/stylus', ['css']);

});

You should not run clean, which will take place if you csshad a dependency on clean.

+4
source share
1

:

...
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://stackoverflow.com/users/145185/overzealous!

+3

Source: https://habr.com/ru/post/1545481/


All Articles