Gist does not let me put directories names in file names, so make sure to put:
assets-Gruntfile.js
inassets/Gruntfile.js
assets-package.json
inassets/package.json
project-Grunt.scala
inproject/Grunt.scala
project-JavaScriptBuild.scala
inproject/JavaSCriptBuild.scala
The goal is to let grunt handle everything in the assets directory.
In the build.sbt, you add JavaScriptBuild.javaScriptUiSettings
to include the JS build config to the sbt config.
Effectively, a grunt build generates compiled assets from the /assets
directories and copies it into /public
, where static assets are accessible.
Additionally, grunt watch
is added as a hook when play run is launched (not as a dependency, since it's a long-running process).
So when you do play stage, npm install && grunt build are executed, the assets are compiled and copied to /public.
make sure to git-ignore compiled assets in /public
For grunt-watch to work locally, you may have to manually do npm install in /assets
. Don't worry, it's only needed locally, as the stage
command triggers it automatically