google/closure-compiler-js

[Please] Add "js_output_file" flag

DazWilkin opened this issue · 2 comments

The JavaScript implement does not currently support designating an output file.

There is a flag with the Java implementation: js_output_file

I believe (!?) a limitation without this is that I'm unable to effectively containerize the compiler by deriving its image from a baseline npm image.

Dockerfile:

FROM gcr.io/cloud-builders/npm
RUN npm install -g google-closure-compiler-js
ENTRYPOINT ["google-closure-compiler-js"]
CMD ["--help"]

I'd like to be able to:

docker run closure:npm -- --js_output_file helloworld.optimized.js helloworld.js

But the default to stdout requires file redirection (I think!?) requires me to expose a shell and then wrap the command:

E.g FROM ubuntu

and then:

docker run closure:big \
  /bin/bash -c "google-closure-compiler-js helloworld.js > helloworld.optimized.js"

The JS version currently does not support any filesystem operations. Adding them is non-trivial, but something I'm looking at.

The cli script used to support npx at https://github.com/google/closure-compiler-npm now supports the js_output_file flag.