I would like to watch all files deeply nested within templates but exclude any folder after build.
So exclude directories like:
./templates/foo/build/**/*
./templates/bar/build/**/*
But include directories and files like:
./templates/foo/template.html
./templates/foo/css/**/*
./templates/bar/template.html
./templates/bar/css/**/*
Currently I am having success itemizing the sub-sub-folder names and sub-sub-filetypes
gulp.watch(['templates/*/*.html','templates/*/*.js',
'templates/*/*.json','templates/*/css/**/*',
'templates/*/js/**/*'], ['build_templates']);
But I would really like to be able to stop updating the expression every time I add specific sub-sub-folders or sub-sub-filetypes. How can include everything except?
I think that you could try to do exclude the build
sub directories with the !
sign.
Think of something like this, adapt it to fits your needs :
gulp.watch([
'templates/**/*',
'!templates/*/{build,build/**}'
], ['build_templates'])
You could also have a look to Gulp Ignore .
我知道这是旧的,但是您应该排除文件夹和文件夹内的所有内容,单独排除文件夹是行不通的。
gulp.watch(['templates/**/*','!templates/{foo, bar}/build/**/*'], ['build_templates']);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.