Matt Briggs
Matt Briggs

Reputation: 42158

splitting grunt watch tasks

So I have 5 grunt-contrib-watch tasks:

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?

Upvotes: 2

Views: 1164

Answers (1)

imjared
imjared

Reputation: 20554

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.

Upvotes: 6

Related Questions