![](/img/trans.png)
[英]How do I match a specific pattern and exclude specific sub-strings with regex
[英]Using Karma, how do I exclude all files that match a pattern except for those within a specific sub-folder?
我有一個簡單的AngularJs應用程序設置,看起來有點像這樣:
client
vendor
angular
bootstrap
jquery
...
app.module.js
app.controller.js
...
node_modules
angular-mocks
...
我正在設置一個karma.conf.js
文件,我想從vendor
包含angular\\angular.js
。 我不想在vendor
包含任何其他內容。
以下是我在相關karma.conf.js
部分中的內容:
files: [
'client/vendor/angular/angular.js',
'client/**/*.js',
'client/**/*.spec.js'
],
exclude: [
'client/vendor/**/*.js'
],
我angular.js
的問題很簡單:我在files
明確地包含了angular.js
,但它在exclude
部分模式中被排除。
如何排除除angular/angular.js
之外的所有client/vendor
(以及之后的其他人)? client
目錄包含許多文件,子文件夾等,其中包含我自己的.js文件,因此僅將我想要包含的所有內容移動到自己的文件夾中並不容易。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.