Gruntjs 如何在使用grunt contrib compress压缩时排除文件夹根目录并仅包含内容
在压缩文件夹中的所有文件时,是否有一种方法可以排除文件夹根目录Gruntjs 如何在使用grunt contrib compress压缩时排除文件夹根目录并仅包含内容,gruntjs,Gruntjs,在压缩文件夹中的所有文件时,是否有一种方法可以排除文件夹根目录 grunt.initConfig({ compress: { main: { files: [ {expand: true, src: ['dist/**', 'xyz/**']}, ] } } }); 如何将dist和xyz文件夹排除在压缩文件之外 谢谢, 帕迪在前面加了一个将否定模式: {expand: true, src: ['dist/**', '!xy
grunt.initConfig({
compress: {
main: {
files: [
{expand: true, src: ['dist/**', 'xyz/**']},
]
}
}
});
如何将dist和xyz文件夹排除在压缩文件之外
谢谢,帕迪在前面加了一个
代码>将否定模式:
{expand: true, src: ['dist/**', '!xyz/**']}
请参阅:在前面加上前缀代码>将否定模式:
{expand: true, src: ['dist/**', '!xyz/**']}
请参阅:如果希望包含文件夹下的文件,则需要更改每个目标的cwd
,以便将它们视为每个glob模式的根
grunt.initConfig({
compress: {
main: {
files: [
{cwd: 'dist/', expand: true, src: ['**']},
{cwd: 'xyz/', expand: true, src: ['**']},
]
}
}
});
grunt.initConfig({
压缩:{
主要内容:{
档案:[
{cwd:'dist/',expand:true,src:['**']},
{cwd:'xyz/',expand:true,src:['**']},
]
}
}
});
如果正在查找,请排除根目录中的文件夹,然后使用模式如果您想要包含文件夹下的文件,您需要更改每个目标的cwd
,以便将它们视为每个全局模式的根
grunt.initConfig({
compress: {
main: {
files: [
{cwd: 'dist/', expand: true, src: ['**']},
{cwd: 'xyz/', expand: true, src: ['**']},
]
}
}
});
grunt.initConfig({
压缩:{
主要内容:{
档案:[
{cwd:'dist/',expand:true,src:['**']},
{cwd:'xyz/',expand:true,src:['**']},
]
}
}
});
如果正在查找,请排除根目录中的文件夹,然后使用代码>Kyle提到的模式