JavaScript Source Compressor 1.00.A

JavaScript Source Compressor is a perl script that can be used to compress the Javascript source file to a much smaller file. The script will replaces large variable names with smaller, generic names and removes unwanted white spaces. By default it will take compress the javascirpt source code given as the arguments and save it as a different file. For example, if the given Javascript code is in the fle 'js_file.js', the script will compress the file and save it to a different file called 'js_file_compressed.js'. Use the second file as the Script file in the HTML page like...
<script language="Javascript" src="js_file_compressed.js" type="text/javascript"></script>

Download the code for JavaScript Source Compressor. The script is distributed in GPL license - so feel free to modify it. NOTE : You should have Perl on your system to use this script.

Features perl SourceCompressor.pl --help

SourceCompressor is a perl script that can be used to compress the Javascript source file to a much smaller file. Replaces large variable names with smaller, generic names and removes unwanted white spaces.

Usage
perl compressor.pl <JS File> [options]
Example :
perl compressor.pl settings.js -display -verbose -change-name
Command Line Options

The first argument MUST be the file name of the JavaScript file.
-verbose - Show details of what is going on.
-readable - Use \\n instead of ';' as the command separator.
-change-name - Rename the variables to a shorter version. Enabled by default.
-remove-vars - Remove the 'var' keyword - this is asking for trouble.
-print - Outputs the compressed data instead of writing it to a file.

Stuff To Do
blog comments powered by Disqus
Subscribe to Feed