Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Grunt, what's the difference between **.js vs **/*.js?

Tags:

gruntjs

I've seen both **.js and **/*.js in some open source projects. As I understand it, **/*.js targets all .js files in all folders recursively.

Then, what does **.js mean? Does it mean the same thing as **/*.js or *.js or something else?

like image 950
Brian Park Avatar asked Oct 20 '25 01:10

Brian Park


1 Answers

The ** is the so-called globstar and it works the same as in bash: It matches directories recursively. The documentation of the minimatch library (which Grunt uses internally) states:

This is supported in the manner of bsdglob and bash 4.1, where ** only has special significance if it is the only thing in a path part. That is, a/**/b will match a/x/y/b, but a/**b will not.

In other words, **.js means the same as *.js.

like image 191
jgillich Avatar answered Oct 22 '25 04:10

jgillich