Subdirectory exclusion from gulp -watch throw type error

I am performing the following view task:

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

    gulp.watch('./ui/scss/*.scss', ['styles']);
    gulp.watch('./js/*.js', '!./js/vendor/*.js', ['scripts']);
    gulp.watch('./**/*.html', ['html']);

});

But does this seem to throw the following error? ...

TypeError: Cannot assign to read only property 'mark' of !./js/vendor/*.js at new Gaze
+4
source share
2 answers

You need brackets around the paths if you want to specify a few. Try the following for your second watch:

gulp.watch(['./js/*.js', '!./js/vendor/*.js'], ['scripts']);

gulp.watchtreats the file argument the same way vinyl-fs. Thus, you can use all the functions indicated in their documentation, c gulp.watch.

+7
source

the second parameter of the clock should be declared as an array

gulp.watch('src...', ['taskname', ......];
+1
source

All Articles