Last Updated: February 25, 2016
·
2.218K
· raddevon

Run the Rails dev server in your Grunt task

It's easy to run the Rails dev server in a Grunt task by using grunt-exec.

exec: {
  server: {
    command: 'rails server'
  }
}

but that's only half the battle. Most likely, you want to do this while developing which means you'll want to be able to run watch as well to compile your pre-processor CSS and lint your JS. Unfortunately, both watch and the rails server are blocking tasks which will monopolize your command line while they are running.

Using grunt-concurrent, you can run the two at the same time.

concurrent: {
  options: {  logConcurrentOutput: true },
  server: {
    tasks: ['watch', 'exec:server']
  }
}