reflex-platform icon indicating copy to clipboard operation
reflex-platform copied to clipboard

Add a flag to run closure-compiler on the output

Open neongreen opened this issue 4 years ago • 2 comments

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?

neongreen avatar Oct 27 '19 06:10 neongreen

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.

andgate avatar Oct 27 '19 22:10 andgate

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
    '';
  }

neongreen avatar Oct 27 '19 23:10 neongreen