简体   繁体   English

Grunt Globbing模式

[英]Grunt Globbing patterns

What is the pattern needed to achieve the following. 实现以下所需的模式是什么?

  1. Match all the html file in the directory .tmp 匹配目录.tmp中的所有html文件
  2. Match all the html file in .tmp/views and all subdirectories of it (recursively to any depth) 匹配.tmp / views中的所有html文件及其所有子目录(递归到任何深度)

This is to register livereload task in Grunt file. 这是在Grunt文件中注册livereload任务。

I tried few varieties of below config. 我试过以下几种配置。 It matches all files in .tmp , but not recursively in .tmp/views 它匹配.tmp中的所有文件,但不会在.tmp/views递归

Also tried, 也尝试过,

 '.tmp/{,views/**/}*.html'

but the same result. 但结果相同。

  livereload: { options: { livereload: LIVERELOAD_PORT }, files: [ '.tmp/{,views/**}*.html' ] } 

You should be able to get the matching you need by passing two elements in the files array: 您应该能够通过在files数组中传递两个元素来获得所需的匹配:

files: [
    '.tmp/*.html',
    '.tmp/views/**/*.html',
]

This will match any .html files directly below .tmp/ , as well as any .html file in .tmp/views/ , whether directly under that directory or deeper (the /**/ part). 这将匹配.tmp/下面的任何.html文件,以及.tmp/views/任何.html文件,无论是直接在该目录下还是更深层( /**/部分)。

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

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