2

So I have 5 grunt-contrib-watch tasks:

  • sass to compile sass files
  • testConcat to concat tests
  • implementationConcat to concat implementation files for testing
  • templates to precompile handlebars templates
  • karma to kick off karma test runs

I know grunt watch would watch all of them, but i really need to split them into two groups -- the first four are for when my designer is running a static server and doing sass work, and the last two are for when I am doing js work.

I am using grunt-concurrent to split them apart and run them concurrently, but while that works, it seems like a bit of a hack. Am I missing something?

Matt Briggs
  • 41,224
  • 16
  • 95
  • 126

1 Answers1

6

Unless I'm missing something I think this is pretty straightforward. You don't necessarily even need 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' ]
  }
}

When you want to run grunt watch, instead of just running grunt watch, specify which one you want: grunt watch:design or grunt watch:dev.

imjared
  • 19,492
  • 4
  • 49
  • 72
  • 1
    He could also create a separate grunt task altogether, that only contains whatever he wants to use for the designer, incl. the watch:design task. So the designer can just use `grunt frontend` or the like... – Patrik Affentranger Jul 03 '13 at 03:08