实现以下目标需要什么模式。
- 匹配
.tmp
目录下的所有html文件> - 匹配 .tmp/views 中的所有 html 文件及其所有子目录(递归到任意深度)
这是在 Grunt 文件中注册 livereload
任务。
我尝试了以下几种配置。它匹配.tmp
中的所有文件,但不匹配.tmp/views
也试过了,
'.tmp/{,views/**/}*.html'
但结果相同。
livereload: { options: { livereload: LIVERELOAD_PORT }, files: [ '.tmp/{,views/**}*.html' ] }
最佳答案
你应该能够通过传递文件数组中的两个元素来获得你需要的匹配:
files: [
'.tmp/*.html',
'.tmp/views/**/*.html',
]
这将匹配 .tmp/
正下方的任何 .html
文件,以及 .tmp 中的任何
,无论是直接在该目录下还是更深(.html
文件/views//**/
部分)。
关于javascript - Grunt Globbing 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18068174/