Deprecation notice: This project is outdated. Alternatives:
npm -g install closurecompiler
Installing globally is recommended if no global JRE is available and the bundled JRE needs to be downloaded, which is about 45mb large.
The API is quite simple and fully explained in a few lines of code:
var ClosureCompiler = ;ClosureCompiler;
Command line utility
Usage: ccjs sourceFiles...|- [--option=value --flagOption ...] [> outFile]
The API and
ccjs support all the command line options of Closure Compiler except
- JVM parameters
-xmxare supported (lower case) just in case that you run out of heap space compiling a rather large code base. When omitted,
-xmxdefaults to 1024m.
-compiler_jarspecifies the absolute path to the Closure Compiler jar file. If not specified the latest installed version will be used.
Usage with Grunt and Gulp
Externs for node.js
ClosureCompiler.js depends on the closurecompiler-externs package,
an npm distribution of node.js Closure Compiler Externs,
which includes externs for all of node's core modules. As a result, specifiying
--externs=node automatically includes
all node.js specific externs in your compile step. If you are using non-core modules, you may still need
additional externs for these.
To update ClosureCompiler.js and/or the underlying Closure Compiler package, just run
npm update. This will
automatically download and set up the latest version of Closure Compiler to be used by ClosureCompiler.js.
Using custom Closure Compiler builds
If you want to use a custom Closure Compiler build for whatever reason, just replace the files in the
ClosureCompiler.js and Closure Compiler itself
Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html
MPL 2.0 License - https://developer.mozilla.org/en-US/docs/Rhino/License
Binary License for OpenJDK - http://openjdk.java.net/legal/binary-license-2007-05-08.html
This package is not officially supported by Google, Mozilla or Oracle. All rights belong to their respective owners.