Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to filter files in gulp.watch?

Tags:

node.js

gulp

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

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 can't be done without external packages, which one is the most reputable?

like image 709
i-- Avatar asked Feb 06 '14 14:02

i--


1 Answers

gulp.watch internally uses vinyl-fs (see source), which uses gaze, which uses itself minimatch, so you should be able to ignore some files using !./js/*.min.*.

In fact, this is even described in vinyl-fs's README:

fs.src(["./js/**/*.js", "!./js/vendor/*.js"]) […] 
like image 130
Paul Mougel Avatar answered Sep 26 '22 21:09

Paul Mougel