【问题标题】:Splitting tasks in gulp在 gulp 中拆分任务
【发布时间】:2016-08-18 11:15:15
【问题描述】:

现在我有多个 gulpfile。每次我开始工作时,我都需要运行多个“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 脚本运行多个 gulp 实例,但看起来只有来自第一个指定 gulpfile 的观察者在工作。简单的 console.logging 显示,第二个 gulpfile 甚至没有启动。它们在单独启动时可以完美运行。

【问题讨论】:

  • 为什么要使用多个 gulpfile?

标签: javascript gulp


【解决方案1】:

您可以尝试将 gulp 命令放入 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

【讨论】:

  • 谢谢,它成功了。我想知道在 gulp 功能中是否有一种方法?好吧,反正我用的是npm,所以不知道有没有关系。
  • 误报。我注意到只有来自第一个指定 gulpfile 的观察者在工作。修改后的帖子以获取更多信息。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-03-13
  • 1970-01-01
  • 1970-01-01
  • 2017-09-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多