JavaScriptZip Documentation

JavaScriptZip is a JavaScript compressor. It removes all comments and unnecessary spaces from the source file.

Some additional optimizations are also performed (wich may be disabled using the disableOptimizations property):

It's written in Java, so you need Java on your system. Java 1.4 or greater is required. If you don't have it, download here.

There are two forms to run JavaScriptZip: via a shell script or Ant task.

Running the script

The script may be runned from <JAVASCRIPTZIP_HOME>/bin directory, or the JAVASCRIPTZIP_HOME environment variable may be set, where it could be runned from any directory. On Windows the script is called javascriptzip.bat. On UNIX, javascriptzip.sh.

These are the arguments:
javascriptzip [options] INPUT OUTPUT, Where:

Running the Ant task

To run the Ant task, you must first define the task using the taskdef task:
<taskdef name="javascriptzip" classname="net.sf.javascriptzip.JavaScriptZipTask" classpath="Path to javascriptzip.jar"/>

Then, use the task itself:
<javascriptzip srcFile="src.js" destFile="dest.js" header="This is the header text"/>

Here are all possible attributes:

One of srcFile and srcDir must be informed. When srcFile, one of destFile or destDir must be informed. Otherwise, srcDir is mandatory. The rest are optional.



To check the JavaDocs, take a look here



javascriptzip.sourceforge.net