Sample of a Grunt.js build integrated into a Play project (in sbt)
The JavaScript application resides in the folder "ui".
The JavaScript application is completely separated from the Play! application.
It is possible to build the JavaScript application separately.
- npm must be installed.
-
Start the play console (with 'play' or 'sbt')
-
To install all JavaScript dependencies:
npm install
- Run the application
run
Grunt runs automatically one time.
Then Grunt is watching for modifications and compiles again when necessary.
- Open the index page http://localhost:9000/
The JavaScript file "ui/src/play-grunt.js" should display "Grunt is integrated" on the page.
- To update all JavaScript dependencies:
npm update
- To prepare the application for production:
stage
Grunt runs automatically before the application is staged.
- integrate grunt build with play
run
command - integrate grunt build with play
stage
command