我有一个项目在根目录有一个Gruntfile.js
文件,该项目还有许多子项目,每个子项目里放置了一个 packing.js
文件。
执行 Gruntfile.js
的时候会循环调用子项目中的 packing.js
添加任务。
Gruntfile.js
部分内容如下
var hubConfig = {
all: {
src: [path + 'app_*/**/packing.js'],
tasks: ['default']
}
};
templateTypes.forEach(function (t) {
var stat = fs.lstatSync(ps.join(root, t));
if (stat.isDirectory() && /^app(_[a-zA-Z0-9_]+)$/.test(t)) {
hubConfig[t] = {
src: [path + t + '/**/packing.js'],
tasks: ['default']
};
}
});
目前是使用 npm build 就打包所有子项目耗时太长。
package.json 部分内容如下
"scripts": {
"build": "./node_modules/.bin/grunt",
},
我现在想的是
执行 npm build a
打包 子项目 1,2,3
执行 npm build b
打包 子项目 4,5,6
应该如何做?
我想的是建立两个Gruntfile.js
文件,但如何配置执行不同的grunt配置文件呢?