2016-04-25 37 views
0

现在我有了多个gulpfiles。每次我开始工作时,我需要运行多个“gulp --gulpfile path/to/another-gulpfile.js”。我可以用一个命令运行它吗?我尝试了“gulp --gulpfile gulpfile1.js gulpfile2.js gulpfile3.js”,但它没有奏效。分解任务

编辑:

"scripts": { 
    "gulp": "gulp --gulpfile bin/gulp-tasks/config.js && gulp --gulpfile bin/gulp-tasks/deploy.js" 
    } 

我尝试使用NPM脚本运行多个实例,一饮而尽,但它看起来像从第一指定gulpfile仅观察家都在工作。简单的console.logging显示,第二个gulpfile甚至没有启动。它们在单独启动时可以很好地工作。

+0

为什么要使用多个gulpfiles的其他方式? – Dai

回答

1

一个方式,你可以尝试把你吞掉命令NPM的package.json

scripts: { 
    gulp: gulp --gulpfile path/to/gulpfile1.js && gulp --gulpfile path/to/gulpfile2.js 
} 

,那么你可以运行一个命令npm run gulp;

你可以参考这篇文章了解更多详情 http://macr.ae/article/splitting-gulpfile-multiple-files.html

+0

谢谢,它的确有用。我想知道单独使用gulp功能有没有办法?那么,我反正使用npm,所以不知道它是否很重要。 – 0xCAFEBABE

+0

虚惊一场。我注意到只有来自第一个指定的gulpfile的观察者正在工作。修改后的更多信息。 – 0xCAFEBABE

+0

http://macr.ae/article/splitting-gulpfile-multiple-files.html试试这个 – Sabrina