ClosureCompiler 0.1
A command line interface to the Closure Compiler onlineservice.
SYNONPSIS
closurecompiler [options] <jsfile>
DESCRIPTION
This man page is just a copy&paste of the Google Closure Compiler Service API Reference. Because all the options of closurecompiler is highly (really, really high) inspired of this apis, I rewrote the page in this man page.
The closurecompiler use the online compiler, for an offline version use the Closure Compiler Application from Google. If the server fails to process your request, you will receive a server error message and the application will exit with an error code. These messages are described in the ERRORS section.
OPTIONS
Required Parameters
| --jscode <code>, -j <code> | |
The code option must be a string containing JavaScript, such as:
alert('hello').
| |
| --codeurl <url>, -u <url> | |
| The --codeurl option must contain the URL of a JavaScript file. You can include multiple codeurl option to specify multiple input files. | |
You must include at least one of --jscode or --codeurl options and you can include both multiples times.
| --level <level>, -l <level> | |
The degree of compression and optimization to apply to your JavaScript. There are three possible compilation levels:
Defaults to a value of simple. | |
| --format <format>, -f <format> | |
The format for the Closure Compiler service's output. There are three possible output formats:
The format option defaults to a value of text. | |
| --info <type>, -i <type> | |
Indicates the kind of output you want from the compiler. There are four possible kinds of output:
| |
Optional Parameters
| --externs <code>, -x <code> | |
| The value of this option must be JavaScript code that declares function names or other symbols. Use --externs to preserve symbols that are defined outside of the code you are compiling. The --externs option only has an effect if you are using a --level of advanced. See Advanced Compilation for more information. | |
| --externurl <url>, -e <url> | |
The value of this option must be the URL of a file containing JavaScript that declares function names or other symbols. The symbols declared in this file are preserved in exactly the same way as symbols listed directly in the --externs option. The --externurl option only has an effect if you are using a --level of advanced. See Advanced Compilation for more information. You can specify this option multiple times if you have multiple externs files. | |
| --nodefault | By default, the Closure Compiler service uses a standard externs file that declares common externally defined symbols like document and all its methods. If you do NOT want to use these common externs, use this option. See Advanced Compilation and Externs for more information about externs. |
| --filename <name>, -f <name> | |
If present, the Closure Compiler service caches the compiled code for one hour and makes it available through a special URL. During this hour you can test the compiled code by pointing your browser to this URL. The URL has this form: http://closure-compiler.appspot.com/code/[sesssion]/[name] | |
| --formatting | If present, this option must have a value of pretty_print or print_input_delimiter. You can provide multiple --formatting options in the. The pretty_print and print_input_delimiter values affect different aspects of the formatting, so you can include both without affecting the way either works.
|
| --closure | If you use this option the compiler looks for goog.require() statements in the source code and supplies the Closure Library code requested by any such statements. It also performs optimizations designed specifically for Closure Library code. See the Closure Library documentation for more information about the Closure Library. See Finding Your Way around the Closure Library for more information about the goog.require() function. Defaults to false. |
| --warning <level>, -w <level> | |
Indicates the amount of information you want from the compiler about possible problems in your code. The --warning parameter only has an effect when an --info parameter with a value of warnings is also supplied. There are three possible warning levels:
| |
ERRORS
If the server fails to process your request, you will receive one of the server error messages listed in the table below. Note that these server error messages are different from compiler errors and warnings. Compiler errors and warnings indicate that Closure Compiler found a problem in your JavaScript code. Server error messages indicate that the compiler is not able to process your code at all because of an error in your request.
- 2 Unknown output mode.
- The value of the output_format parameter is something other than xml, json, or text.
- 4 Unknown compression level.
- The value of the --level parameter is something other than WHITESPACE_ONLY, SIMPLE_OPTIMIZATIONS, or ADVANCED_OPTIMIZATIONS.
- 9 File too large.
- The total amount of code from all --codeurl files, all --externurl files, all --jscode code and all --externs code exceeds 500k.
- 10 Cannot retrieve content from URL.
- An error occurred when the Closure Compiler service tried to retrieve either a JavaScript file indicated in the --codeurl parameter or an externs file indicated in the --externurl parameter. Check that the URL is correct and that the permissions of the file allow it to be viewed.
- 12 URL is not formed properly.
- The value of either the --codeurl parameter or the --externurl parameter is not a well-formed URL.
- 13 No output information to produce, yet compilation was requested.
- No --info parameter has been specified.
- 14 Unknown --info value.
- The value of an --info parameter is something other than compiled_code, warnings, or statistics.
- 16 Unknown warning level.
- The value of the --warning parameter is something other than QUIET, DEFAULT, or VERBOSE.
- 17 Unknown formatting option.
- The value of the --formatting parameter is something other than pretty_print or print_input_delimiter.
- 18 Unknown parameter in HTTP request.
- The HTTP request contains a parameter other than one of the ones listed in this document.
- 19 Illegal value for --filename.
- The output file name contains a character a number, letter, dot, underscore, or dash, or it contains two consecutive dots (..)
- 22 Too many compiles performed recently. Try again later.
- You have submitted too many compiles from your machine. After an hour, you should be able to perform compiles again.
- 23 Compiler exception (with backtrace).
- The compiler crashed. The text of the error will contain information to help Google debug the problem.
- 24 Unsupported input resource type.
- The resource type is not http and so the input file will not be retrieved.
| File | Type | Py Version | Uploaded on | Size | # downloads |
|---|---|---|---|---|---|
| ClosureCompiler-0.1-py2.4.egg (md5, pgp) | Python Egg | 2.4 | 2009-11-16 | 12KB | 1087 |
| ClosureCompiler-0.1-py2.5.egg (md5, pgp) | Python Egg | 2.5 | 2009-11-16 | 12KB | 818 |
| ClosureCompiler-0.1.tar.gz (md5, pgp) | Source | 2009-11-16 | 10KB | 644 | |
- Author: Marco Giusti
- Home Page: http://bitbucket.org/gm/closurecompiler/
- License: MIT
- Platform: any
- Categories
- Package Index Owner: gm
- DOAP record: ClosureCompiler-0.1.xml
