I'm using Play framework 2.3.6 and Webjars for web lib dependencies. That is, my build.sbt contains something like "org.webjars" % "angularjs" % "1.2.26". To uglify my Javascript sources I added pipelineStages := Seq(rjs, uglify, digest, gzip) to my build.sbt.
Now, when running Play's 'stage' or 'dist' tasks it looks like all Javascript files getting uglified, that is, also files from the Webjar libraries.
[info] Uglify2 file: /target/web/rjs/build/lib/angularjs/angular.js
I would have expected that sources from the external Webjar libraries are left untouched as there already is a minified version. One problem with that is that the uglify process takes way too long. How can I speed up the uglification process?
There are two ways to speed up the Javascript building steps:
Install node.js and set export SBT_OPTS="$SBT_OPTS -Dsbt.jse.engineType=Node"
before running the activator
. Using node.js instead of the default Javascript engine gives a very significant speedup. More details can be found here: Migration to play 2.3, see section about sbt-web
Customize the build steps, e.g.
RjsKey.optimize := "none"
includeFilter in uglify := GlobFilter("myjs/*.js"),
You can find more details about the options on the github site of these plugins: