Using Play-Framework 2.1(rc4) and the "built-in" RequireJS, everything works great, and Play successfully compress (uglify) all my JS files in PROD, but I'd like it to join all of them in one JS file.
Is this possible? If yes, how to do so ? Is there a build.js to make with these directives ?
Yes it is possible.
You have to add the requireJsShim
in the Build.scala file. Often, the value of requireJsShim
is the same as the requireJs
property.
Once you've done that, everything will be compiled in one file!
There is an example project for Play 2.1.0: https://github.com/schleichardt/play-2.1-features/tree/stackoverflow-question-14704169 (it is not in the master but in the stackoverflow-question-14704169 branch)
play dist
(! means in JAR or ZIP)
And dist/play-2-1-features-1.0-SNAPSHOT.zip!play-2-1-features-1.0-SNAPSHOT/lib/play-2-1-features_2.10-1.0-SNAPSHOT.jar!public/javascripts-min/main.js contains all JavaScript/CoffeeScript code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With