Gulp-filter works weird and wrong

49 views Asked by At

I have this little piece of code:

gulp.src('src/*.*')
    .pipe(filter(['**', '!**/*.{png,jpg,bmp,jpeg,jpeg2,webp,svg}', '!**/*.{css,less}']))
    .pipe(gulp.dest('dev/'));

This code should move any files if it is not image or an style. But this filter only filters every file in directory. For example: moves only src/index.php, src/script.js or src/page.html, but src/assets/script.js filters

I tried to use one or none asterisks (filters everything). Tried to use only one filter instead of two.

Why this plugin is so weird? How can i use it correctly?

1

There are 1 answers

1
Mark On

It has nothing to do with gulp-filter actually. Your gulp.src doesn't include any subfolders. You have:

gulp.src('src/*.*')

should be

gulp.src('src/**/*.*')