使用 grunt concat-json 排除文件
Exclude file with grunt concat-json
我正在使用 concat-json
将多个 json
合并为一个。但是,目标 src
不同,这意味着我从两个不同的路径读取。
在这些路径之一上,我想排除一个不包含在 concat
中的特定文件。在 npm
文档中,我没有找到任何与合并时排除文件相关的内容。
这是我指定不同目标的方式:
grunt.initConfig({
"concat-json": {
"en": {
src: [ "reports/*.json" ],
dest: "reports/request.json"
},
"de": {
//Here is where I want to merge all jsons but one in specific
src: [ "reports/temp/*.json" ],
dest: "reports/request.json"
}
}
});
您可以指定exclusions in Grunt globbing patterns。
使用以下配置,not-me.json
文件将被排除:
grunt.initConfig({
"concat-json": {
"en": {
src: ["reports/*.json"],
dest: "reports/request.json"
},
"de": {
src: ["reports/temp/*.json", "!reports/temp/not-me.json"],
dest: "reports/request.json"
}
}
});
我正在使用 concat-json
将多个 json
合并为一个。但是,目标 src
不同,这意味着我从两个不同的路径读取。
在这些路径之一上,我想排除一个不包含在 concat
中的特定文件。在 npm
文档中,我没有找到任何与合并时排除文件相关的内容。
这是我指定不同目标的方式:
grunt.initConfig({
"concat-json": {
"en": {
src: [ "reports/*.json" ],
dest: "reports/request.json"
},
"de": {
//Here is where I want to merge all jsons but one in specific
src: [ "reports/temp/*.json" ],
dest: "reports/request.json"
}
}
});
您可以指定exclusions in Grunt globbing patterns。
使用以下配置,not-me.json
文件将被排除:
grunt.initConfig({
"concat-json": {
"en": {
src: ["reports/*.json"],
dest: "reports/request.json"
},
"de": {
src: ["reports/temp/*.json", "!reports/temp/not-me.json"],
dest: "reports/request.json"
}
}
});