This is my folder structure
views
|
- core
| |
| -core.module.js
| core.controller.js
| some.js
|
- home
|
-home.module.js
home.controller.js
somemore.js
...
...
and in my gulp file I want to include all js
files from views
folder recursively and exclude *.controller.js
from all folders but the core
i.e select all js
files from core
folder and select all but *.controller.js
from all other folders
I tried like below, but its excluding *.controller.js
files from core
folder too.
gulp.src([
//include all from all folders
'views/**/*.js',
//exclude *.controller.js from all folders but core (not working)
'!views/{**, !core}/*.controller.js'
])
答案 0 :(得分:4)
使用!()
glob模式。来自glob
documentation:
!(pattern|pattern|pattern)
匹配任何与所提供的任何模式都不匹配的内容。
因此,在您的情况下,您可以执行以下操作:
gulp.src([
'views/**/*.js',
'!views/!(core)/**/*.controller.js'
])