This is more of a personal experience than a how-to.
With newer versions of Play 2.x (especially Play 2.3) things started to change and I realised even though I made a certain amount of effort to adapt to the Play workflow for assets, it still didn't really do what I actually needed.
“Back to the roots”
Although I really love Play and 2.3 added some interesting new features, I came to the conclusion that I no longer wanted to depend on a web framework’s set of (changing) features to build assets. So I went back to the roots, which in my case means Bower and Grunt.
“You don’t have to use everything Play offers.”
Now I keep the web application itself and its assets more or less completely separate – and I'm quite happy with that. This means, I no longer use the directory
/app/assets at all.
Instead I create a new directory
/bower_components and a
Gruntfile.js (also in the root directory of the project) defines all Grunt tasks.
The three main Grunt tasks are
default to build all assets for development mode,
watch to monitor changes of raw assets and rebuild certain assets automatically as required and finally
dist which runs the
The destination path for all these files is
/public. This means all the Play app has to do with assets is serve them as static files.
This way I’m completely independent from Play’s built-in features, I don't have to deal with third-party Java modules for asset building, I can tap a vast range of Bower and Grunt packages and – most importantly – I’m a lot more used to that workflow.
Next time I’ll talk about where exactly my dev and production assets live and how to have them distributed via a CDN.