Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gulp - Exclude file not working

Tags:

node.js

gulp

In my gulpfile I have a task which builds and writes everything to a dist folder. Now I'm trying to write another task that cleans out everything in dist except for my vendor bundle. This is what I have so far:

gulp.task('clean', function () {
    return gulp.src(['./dist', '!./dist/scripts/vendor.js'])
        .pipe($.clean());
});

When I run this it deletes dist altogether. What's the right way to exclude just one file?

Note: I've also tried using gulp-ignore and gulp-filter with the same results.

like image 823
serverpunk Avatar asked Jan 29 '26 18:01

serverpunk


1 Answers

This Github issue led me in the right direction. The pattern I wanted was

['dist/*, '!dist/scripts{,/vendor.js}'].

If anyone knows of any good globbing docs that would be super helpful :)

like image 172
serverpunk Avatar answered Jan 31 '26 15:01

serverpunk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!