打开 yeoman 生成的 Gruntfile.js,我看到这个:
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= config.app %>',
dest: '<%= config.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'images/{,*/}*.webp',
'{,*/}*.html',
'styles/fonts/{,*/}*.*'
]
}]
},
styles: {
expand: true,
dot: true,
cwd: '<%= config.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},
{,*/}*.*
是什么意思?我可以看到它试图从文件夹中获取所有内容,并且我知道 * 表示任何字符。但我不知道该模式到底是做什么的......
请帮忙。非常感谢。
最佳答案
{,*/}*.*
相当于 */*.* OR *.*
这是一种全局模式,用于搜索所有文件,但仅搜索 1 个文件夹深度。
如果你想搜索所有子目录中的文件,你可以使用类似**/*.*
的东西,但如果文件夹树很深,它会使用更多的CPU。
关于javascript - Gruntfile.js 中的 {,*/}*.* 是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22447309/