当您压缩文件夹中的所有文件时,有没有一种方法可以排除文件夹根目录?
grunt.initConfig({
compress: {
main: {
files: [
{expand: true, src: ['dist/**', 'xyz/**']},
]
}
}
});
我们如何才能将 dist 和 xyz 文件夹排除在压缩文件中?
谢谢,
稻田
当您压缩文件夹中的所有文件时,有没有一种方法可以排除文件夹根目录?
grunt.initConfig({
compress: {
main: {
files: [
{expand: true, src: ['dist/**', 'xyz/**']},
]
}
}
});
我们如何才能将 dist 和 xyz 文件夹排除在压缩文件中?
谢谢,
稻田
如果您希望包含文件夹下的文件,则需要更改cwd每个目标的 ,以便将它们视为每个 glob 模式的根
grunt.initConfig({
压缩:{
主要的: {
文件:[
{cwd: 'dist/', 展开: true, src: ['**']},
{cwd: 'xyz/', 展开: true, src: ['**']},
]
}
}
});
如果您正在寻找只是排除根目录中的文件夹,然后使用!凯尔提到的模式
Prepending a ! will negate a pattern:
{expand: true, src: ['dist/**', '!xyz/**']}