- Notifications
You must be signed in to change notification settings - Fork33
Closure Compiler for node.js - the all-round carefree package.
License
dcodeIO/ClosureCompiler.js
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Deprecation notice: This project is outdated. Alternatives:
- google-closure-compiler-js No Java needed!
- google-closure-compiler Offical wrapper
- closure-compiler
- closure-builder
The all-round carefree package. Automatically downloads and sets upClosure Compilerand a JRE built fromOpenJDK if required. No environment variables to set, works out ofthe box.
Install:npm -g install closurecompiler
Installing globally is recommended if no global JRE is available and the bundled JRE needs to be downloaded, which isabout 45mb large.
The API is quite simple and fully explained in a few lines of code:
varClosureCompiler=require("closurecompiler");ClosureCompiler.compile(['file1.js','file2.js'],{// Options in the API exclude the "--" prefixcompilation_level:"ADVANCED_OPTIMIZATIONS",// Capitalization does not matterFormatting:"PRETTY_PRINT",// If you specify a directory here, all files inside are usedexterns:["externs/file3.js","externs/contrib/"],// ^ As you've seen, multiple options with the same name are// specified using an array. ...},function(error,result){if(result){// Write result to file// Display error (warnings from stderr)}else{// Display error...}});
Usage: ccjs sourceFiles...|- [--option=value --flagOption ...] [> outFile]
The API andccjs
support all the command line options of Closure Compiler except--js
and--js_output_file
.
Additional options:
- JVM parameters
-xms
and-xmx
are supported (lower case) just in case that you run out of heap space compiling a rather large code base. When omitted,-xmx
defaults to 1024m. -compiler_jar
specifies the absolute path to the Closure Compiler jar file. If not specified the latest installed version will be used.
ClosureCompiler.js depends on theclosurecompiler-externs package,an npm distribution ofnode.js Closure Compiler Externs,which includes externs for all of node's core modules. As a result, specifiying--externs=node
automatically includesall node.js specific externs in your compile step. If you are using non-core modules, you may still needadditional externs for these.
To update ClosureCompiler.js and/or the underlying Closure Compiler package, just runnpm update
. This willautomatically download and set up the latest version of Closure Compiler to be used by ClosureCompiler.js.
If you want to use a custom Closure Compiler build for whatever reason, just replace the files in thecompiler/
directory.
Feross Aboukhadijeh
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.
About
Closure Compiler for node.js - the all-round carefree package.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors15
Uh oh!
There was an error while loading.Please reload this page.