gulp globbing - 如何查看目录下的所有内容 [英] gulp globbing- how to watch everything below directory
问题描述
这是一个非常愚蠢的问题,但我还没有真正找到满意的答案:How do I use gulp globbing to select all files in all某个目录下的子目录?
This is a pretty dumb question, but I haven't really been able to find a satisfactory answer: How do I use gulp globbing to select all files in all subdirectories below a certain directory?
我试过了:
'./src/less'
'./src/less/'
'./src/less/*'
它们似乎都不起作用.
推荐答案
所有目录下所有文件的模式通常为./src/less/**/*.*
或./src/less/**/*
,应该可以.
The pattern for all files under all directories is usually ./src/less/**/*.*
or ./src/less/**/*
, either should work.
一般来说,最好匹配特定的文件扩展名——即使它们都应该相同——以防止抓取系统文件或其他垃圾.在这种情况下,您可以为 ./src/less/**/*.less
仅对 .less
文件或类似 .src/less/的文件执行**/*.{less,css}
用于 .less
和 .css
文件.
Generally speaking, it's better to match specific files extensions — even if they should all be the same — to prevent grabbing system files or other junk. In that case, you can do ./src/less/**/*.less
for just .less
files, or something like .src/less/**/*.{less,css}
for both .less
and .css
files.
Grunt 网站 对大多数 minimatch glob 都有很好的参考.(Grunt 和 gulp 都使用 minimatch,因为它是几乎所有与 Node 相关的 glob 库.)
The Grunt website has a pretty good reference for the majority of minimatch globs. (Both Grunt and gulp use minimatch, since it's the glob library for pretty much everything Node related.)
gulp 或 minimatch 拥有自己的完整文档会很好,但这对你来说是开源的.
It would be nice for gulp or minimatch to have their own complete docs, but that's open source for you.
这篇关于gulp globbing - 如何查看目录下的所有内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!