What is the ** glob character?

前端 未结 4 1377
野趣味
野趣味 2020-12-01 02:49

I have this path in my react gulpfile:

var path = {
  HTML: \'src/index.html\',
  ALL: [\'src/js/*.js\', \'src         


        
相关标签:
4条回答
  • 2020-12-01 03:02

    ** matches any character including a forward-slash /
    * matches any character except a forward-slash (to match just the file or directory name)

    0 讨论(0)
  • 2020-12-01 03:06

    Like Grunt, the double ** is saying, "Look in all the subfolders within js and for all of the .js files."

    You can actually refer here for the same:

    https://www.codefellows.org/blog/quick-intro-to-gulp-js

    0 讨论(0)
  • 2020-12-01 03:08

    It's almost the same as the single asterisk but may consist of multiple directory levels.

    In other words, while /x/*/y will match entries like:

    /x/a/y
    /x/b/y
    

    and so on (with only one directory level in the wildcard section), the double asterisk /x/**/y will also match things like:

    /x/any/number/of/levels/y
    

    with the concept of "any number of levels" also including zero (in other words, /x/**/y will match /x/y as one of its choices).


    As an aside, as much as I hate to credit the mainframe with anything, I believe this has been used since the earlist days of MVS to allow selection of datasets at multiple levels :-)

    0 讨论(0)
  • 2020-12-01 03:16

    It's usually used to indicate any number of subdirectories. So

    src/js/**/*.js
    

    Would match

    src/js/files/*.js
    src/js/more-files/*.js
    
    etc
    etc
    
    0 讨论(0)
提交回复
热议问题