Javascript uglification acceleration in Play 2.3.x for external Webjar sources

I am using Play Framework 2.3.6 and Webjars for dependencies in web library. That is, my build.sbt file contains something like "org.webjars"% "angularjs"% "1.2.26". To strip out my Javascript sources, I added buildStages: = Seq (rjs, uglify, digest, gzip) to my build.sbt file.

Now when you run the "stage" or "dist" jobs, it looks like all the Javascript files are zeroed out, that is, the files from the Webjar libraries as well.
[info] Uglify2 file: / target / web / rjs / build / lib / angularjs / angular.js

I would assume the sources from the external Webjar libraries remain intact as there is already a mini version. One problem is that the uglify process is taking too long. How can I speed up the coalification process?

+3


source to share


2 answers


There are two ways to speed up your Javascript creation steps:

  • Install node.js and install export SBT_OPTS="$SBT_OPTS -Dsbt.jse.engineType=Node"

    before running activator

    . Using node.js instead of the default Javascript engine gives a very significant speedup. More information can be found here: Moving to 2.3, see sbt-web section

  • Customize your build steps eg.

    • disable minification by adding to build.sbt: RjsKey.optimize := "none"

    • limit uglification by adding to build.sbt: eg. includeFilter in uglify := GlobFilter("myjs/*.js"),

More information on the options on the github site of these plugins can be found:



sbt-uglify

sbt-rjs

+1


source


Although the sbt-uglify documentation says that excludeFilter should exclude websites and a shared folder, this is not the case.

Follow Martin's answer setup, except it goes back to overlooking, add S to RjsKeys:



RjsKeys.optimize := "none"

      

+1


source







All Articles