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

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”.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)