分裂咕噜咕噜的手表任务

Mat*_*ggs 2 javascript gruntjs grunt-contrib-watch grunt-concurrent

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

  • sass编译sass文件
  • testConcat进行concat测试
  • implementationConcat用于concat实现文件的测试
  • 用于预编译车把模板的模板
  • 业力开始业力测试运行

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

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

imj*_*red 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' ]
  }
}
Run Code Online (Sandbox Code Playgroud)

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