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.
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 :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With