问题
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.
回答1:
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 :)
来源:https://stackoverflow.com/questions/23790544/gulp-exclude-file-not-working