简体   繁体   English

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

[英]glob for all folders within a folder except one named folder

I am writing my Karma conf based on 我正在写我的Karma conf

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

The key for the preprocessor is a glob string. 预处理器的关键是一个glob字符串。

This works for all folders within the build folder: 这适用于构建文件夹中的所有文件夹:

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

However, I don't want all folders. 但是,我不想要所有文件夹。 I wanted folder 1,2,4,5 NOT folder 3 我想文件夹1,2,4,5不是文件夹3

Can I write that in a single string (as seems to be required by karma)? 我可以用一个字符串写出来(似乎是业力需要的)吗?

Something like 就像是

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

or even better 甚至更好

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

This covers it 这涵盖了它

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

Quoting it 引用它

You can make this work using brace expansion. 您可以使用大括号扩展来完成这项工作。 For @chevalric's case, the following pattern will do it: 对于@ chevalric的情况,以下模式将执行此操作:

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

This expands to two patterns: 这扩展到两种模式:

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

Also it later says .. 后来又说..

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

worked 工作

However, for me, I could not test that this worked for various reasons. 但是,对我来说,我无法测试这是否因各种原因而起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM