Glob / minimatch: how to gulp.src() everything, then exclude folder but keep one file in it

↘锁芯ラ 提交于 2019-11-28 19:10:53
Heikki

This seems to work:

gulp.src([
    baseDir + '/**',                              // Include all
    '!' + baseDir + '/excl1{,/**}',               // Exclude excl1 dir
    '!' + baseDir + '/excl2/**/!(.gitignore)',    // Exclude excl2 dir, except .gitignore
], { dot: true });

Excluding single file from glob match was tricky because there's no similar examples in minimatch docs.

https://github.com/isaacs/minimatch

"If the pattern starts with a ! character, then it is negated".

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