Gulp stop / cancel task execution

How can I cancel / stop the current current task in gulp?

My task:

gulp.task('scripts', function() { return gulp.src('js/main.js') .pipe(browserify({ transform: [to5ify] })) .pipe(gulp.dest('./dist')); }); 

It works in hours:

 gulp.task('watch', function() { gulp.watch('js/**/*.js', ['scripts']); }); 

If I modify the js file, the task is done, this is good. But if I change another file during the execution of the task, the task does not stop and does not restart. How can i fix this?

The task takes an average of 20 seconds, and the described case often occurs

+7
gulp gulp-watch
source share

No one has answered this question yet.

See related questions:

1203
NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. Webpack
149
Gulp Crash / Crash Prevention
7
How to combine gulp -watch and gulp -ject?
4
Gulp watch ... not looking?
3
You need to run gulp several times to get style changes
2
gulp.watch performs one task several times while saving a large number of files
2
Gulp watches fly out between them if any error is detected
2
Gulp-sass will not compile scss files for css, but copy all files from the scss folder to the css folder
0
Run gulp task with parameter from observer
0
Access to the home directory with the base in Gulp

All Articles