This is interesting, I never heard of google-closure-compiler
before but it seems to work really well, plus it also transpiles your code, meaning one less dependency to set up!
Using elm make --optimize
and your configurations exactly, I tested it with elm-spa-example, which of course is the benchmark Evan is using in his post.
UglifyJS
Initial size: 370448 bytes (elm.js)
Minified size: 96879 bytes (elm.uglify.min.js)
Gzipped size: 30597 bytes
Google Closure Compiler
Initial size: 370448 bytes (elm.js)
Minified size: 97254 bytes (elm.closure.min.js)
Gzipped size: 31100 bytes
The results are almost identical. GCC also has an option for advanced compilation, but it doesn’t seem to work with the outputted Elm code.
Considering GCC is a bit faster and will also transpile code, it seems like the way to go!