reflex-platform
reflex-platform copied to clipboard
Add a flag to run closure-compiler on the output
Currently I manually run closure-compiler all.js --compilation_level=ADVANCED_OPTIMIZATIONS --jscomp_off=checkVars --externs=all.js.externs > all.min.js
after compiling my project with Nix. Would it make sense to have a flag to do this automatically?
I came here to check for this specific issue. Additionally, I'd like for index.html
to use all.min.js
instead of lib.js
, out.js
, and rts.js
.
In the meantime I figured out how to do it automatically, but a flag would still be nice.
pkgs.stdenv.mkDerivation {
inherit (foo) name version;
buildCommand = ''
mkdir -p $out
cp ${foo}/bin/foo.jsexe/{rts,lib,out,runmain}.js $out
${pkgs.closurecompiler}/bin/closure-compiler \
${foo}/bin/foo.jsexe/all.js \
--compilation_level=ADVANCED_OPTIMIZATIONS \
--jscomp_off=checkVars \
--externs=${foo}/bin/foo.jsexe/all.js.externs \
> $out/all.min.js
'';
}