首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >glob的目录/和目录/*和目录/**和目录/**/*有什么区别?

glob的目录/和目录/*和目录/**和目录/**/*有什么区别?
EN

Stack Overflow用户
提问于 2014-09-14 11:20:11
回答 1查看 118关注 0票数 0

我正在使用gulp构建我的开发工作流程。Gulp及其插件大量使用glob。

我对以下内容之间的区别感到困惑:

代码语言:javascript
复制
directory/ 
directory/* 
directory/** 
directory/**/*

我不能让gulp做我想要的事情。

EN

回答 1

Stack Overflow用户

发布于 2014-09-15 05:27:40

Grunt很好地解释了globs的工作原理http://gruntjs.com/configuring-tasks#globbing-patterns

代码语言:javascript
复制
* matches any number of characters, but not /
** matches any number of characters, including /, as long as it's the only thing
   in a path part. So a/**/b will match a/x/y/b, but a/**b will not.

directory/ = this isn't a glob and would evaluate as expected.
directory/* = will match anything in the directory, but not sub-directories.
directory/** = will match anything in the directory and all subdirectories.
directory/**/* = will match anything in the directory and all subdirectories. 
                 (good for adding a prefix like an extension to the end)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25829761

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档