Play! is planning to offer much better answers to front-end issues in the following versions, but this was not always the case. SBT plugins available — if available at all — were not always perfectly fit for our needs, and for me as a front-end developer getting into SBT plugin development was a bit steep of a learning curve. Grunt had a larger community and a pretty rich set of tasks, that is why we decided to move all our front-end operations to Grunt. Still, we wanted to integrate it with Play! at some level, and here is how we did it. Pretty easy to be honest.

This Scala trait, when integrated in your Build.scala, will start and stop a grunt-contrib-watch task on Play! run and stop and will also install all the necessary npm modules defined in your package.json file. This solution is kind of a trade-off as Grunt tasks run by the watch task will not block code compilation or page rendering. Still, you have Grunt logging in the Play! console this way, and that is pretty much enough most of the time.