分裂咕噜咕噜的手表任务

时间:2013-07-02 22:48:40

标签: javascript gruntjs grunt-contrib-watch grunt-concurrent

所以我有5 grunt-contrib-watch个任务:

  • sass编译sass文件
  • testConcat到concat测试
  • implementationConcat to concat实现文件以进行测试
  • 用于预编译把手模板的模板
  • 业力启动业力测试运行

我知道grunt watch会看到所有这些,但我真的需要将它们分成两组 - 前四个用于我的设计师运行静态服务器并执行sass工作时,最后两个我正在做js工作。

我正在使用grunt-concurrent将它们分开并同时运行它们,但是虽然这有效,但它似乎有点像黑客。我错过了什么吗?

1 个答案:

答案 0 :(得分:6)

除非我遗漏了一些东西,否则我觉得这很简单。你甚至不需要grunt-concurrent。

watch: {
  design: {
    files:[ 'foo/designFile.scss', 'foo/testwhatever' ],
    tasks: [ 'sass', 'testConcat', etc... ]
  },
  dev: {
    files:[ 'foo/files.hbars', 'foo/file.test' ],
    tasks: [ 'templates', 'karma' ]
  }
}

如果您想要运行grunt watch,而不是仅仅运行grunt watch,请指定您想要的那个:grunt watch:designgrunt watch:dev

相关问题