文件夹内除一个命名文件夹外的所有文件夹的 glob

glob for all folders within a folder except one named folder

我正在基于

编写我的 Karma conf

http://karma-runner.github.io/1.0/config/preprocessors.html

预处理器的键是一个 glob 字符串。

这适用于构建文件夹中的所有文件夹:

build/**/!(*.spec|*.bundle|*.min).js

但是,我不想要所有文件夹。我想要文件夹 1、2、4、5 而不是文件夹 3

我可以把它写在一个字符串中吗(这似乎是因果报应所要求的)?

类似于

build/(folder1|folder2|folder4|folder5)/!(*.spec|*.bundle|*.min).js

甚至更好

build/** but not folder 3/!(*.spec|*.bundle|*.min).js

这就涵盖了

https://github.com/karma-runner/karma-coverage/issues/13

引用它

您可以使用大括号扩展来完成这项工作。对于@chevalric 的情况,可以使用以下模式:

src/*/{*.js,!(test)/**/*.js}

这扩展为两种模式:

src/*/*.js              # Match files in the module root
src/*/!(test)/**/*.js   # Match files in all subfolders except test/

后面还说..

src/*/!(test)/**/*.js

工作

但是,对我来说,出于各种原因我无法测试这是否有效。