Thursday, 15 July 2010

playframework - Speed up Javascript uglification in Play 2.3.x build for external Webjar sources -



playframework - Speed up Javascript uglification in Play 2.3.x build for external Webjar sources -

i'm using play framework 2.3.6 , webjars web lib dependencies. is, build.sbt contains "org.webjars" % "angularjs" % "1.2.26". uglify javascript sources added pipelinestages := seq(rjs, uglify, digest, gzip) build.sbt.

now, when running play's 'stage' or 'dist' tasks looks javascript files getting uglified, is, files webjar libraries. [info] uglify2 file: /target/web/rjs/build/lib/angularjs/angular.js

i have expected sources external webjar libraries left untouched there minified version. 1 problem uglify process takes way long. how can speed uglification process?

there 2 ways speed javascript building steps:

install node.js , set export sbt_opts="$sbt_opts -dsbt.jse.enginetype=node" before running activator. using node.js instead of default javascript engine gives important speedup. more details can found here: migration play 2.3, see section sbt-web

customize build steps, e.g.

disable minification adding build.sbt: rjskey.optimize := "none" limit uglification adding build.sbt: e.g. includefilter in uglify := globfilter("myjs/*.js"),

you can find more details options on github site of these plugins:

sbt-uglify

sbt-rjs

javascript playframework sbt uglifyjs2 webjars

No comments:

Post a Comment