Skip to content

Instantly share code, notes, and snippets.

@MaanooAk
Forked from gurdiga/minify-js.sh
Created December 28, 2016 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaanooAk/321d7e7403293625faed5cad5144c37b to your computer and use it in GitHub Desktop.
Save MaanooAk/321d7e7403293625faed5cad5144c37b to your computer and use it in GitHub Desktop.
JS minifying script with curl and Closure Compiler REST API
#!/bin/sh
# Use like this:
#
# minify-js.sh < app.js > app.min.js
#
curl -s \
-d compilation_level=SIMPLE_OPTIMIZATIONS \
-d output_format=text \
-d output_info=compiled_code \
-d charset=utf-8 \
--data-urlencode "js_code@-" \
http://closure-compiler.appspot.com/compile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment