当您压缩文件夹中的所有文件时,有没有办法可以排除文件夹根目录?
grunt.initConfig({
compress: {
main: {
files: [
{expand: true, src: ['dist/**', 'xyz/**']},
]
}
}
});
Run Code Online (Sandbox Code Playgroud)
我们如何排除dist和xyz文件夹被包含在压缩文件中?
谢谢,
帕迪
如果您想要包含该文件夹下的文件,则需要更改cwd每个目标,以便将它们视为每个glob模式的根目录
grunt.initConfig({
compress: {
main: {
files: [
{cwd: 'dist/', expand: true, src: ['**']},
{cwd: 'xyz/', expand: true, src: ['**']},
]
}
}
});
如果您只想排除根目录中的文件夹,请使用!Kyle提到的模式
预设!遗嘱否定了一种模式:
{expand: true, src: ['dist/**', '!xyz/**']}
Run Code Online (Sandbox Code Playgroud)
请参阅:http://gruntjs.com/configuring-tasks#globbing-patterns
| 归档时间: |
|
| 查看次数: |
3574 次 |
| 最近记录: |