gulp - Exclude file not working

烈酒焚心 提交于 2019-12-10 18:08:19

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!