我正在使用gulp构建我的开发工作流程。 Gulp及其插件大量使用glob。
我对以下两者之间的差异感到困惑:
directory/
directory/*
directory/**
directory/**/*
我无法做出我期望的事情。
答案 0 :(得分:1)
Grunt对globs的工作方式有很好的解释http://gruntjs.com/configuring-tasks#globbing-patterns
* 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)