Best way to filter files in gulp.watch?

I would like to see everything, but the .min.ext files in my directories with gulp.js. What is the best way to filter them out?

Example:

gulp.task('watch', function(e) { gulp.watch('./js/*.js', ['css']); // don't want to watch .min.js files. what is best way? }); 

EDIT: If this cannot be done without external packages, which one is most right?

+54
gulp
Feb 06
source share
1 answer

gulp.watch internally uses vinyl-fs (see source ), which uses gaze , which uses minimatch , so you can ignore some files with !./js/*.min.* .

In fact, it is even described in vinyl-fs README :

 fs.src(["./js/**/*.js", "!./js/vendor/*.js"]) […] 
+90
Feb 06
source share



All Articles