Javascript 如何在minimatch中一次性匹配html或js?
我正在为GulpWatch编写glob模式,并希望在每个html或js更改上重新构建Javascript 如何在minimatch中一次性匹配html或js?,javascript,node.js,glob,Javascript,Node.js,Glob,我正在为GulpWatch编写glob模式,并希望在每个html或js更改上重新构建 # my first variant > minimatch('src/app/app.js', 'src/app/**/*.(js|html)') false # not working > minimatch('src/app/app.js', 'src/app/**/*.+(js|html)') true # this works > minimatch('src/app/app.jsj
# my first variant
> minimatch('src/app/app.js', 'src/app/**/*.(js|html)')
false # not working
> minimatch('src/app/app.js', 'src/app/**/*.+(js|html)')
true # this works
> minimatch('src/app/app.jsjs', 'src/app/**/*.+(js|html)')
true
# but also this works:
> minimatch('src/app/app.jsjsjsjsjs', 'src/app/**/*.+(js|html)')
true
如何正确地在中执行,意思是只匹配html或js一次,就像在正则表达式中一样?您要求它匹配一个或多个
(.js |.html)
您需要使用@
只匹配一个
minimatch('src/app/app.js', 'src/app/**/*.@(js|html)')
您要求它匹配一个或多个
(.js |.html)
您需要使用@
只匹配一个
minimatch('src/app/app.js', 'src/app/**/*.@(js|html)')
看起来您可以使用以下选项:
minimatch('src/app/app.js', 'src/app/**/*.{js,html}')
看起来您可以使用以下选项:
minimatch('src/app/app.js', 'src/app/**/*.{js,html}')