- Compresses and obfuscates script content by removing unrequired white space and comments to reduce file size (using Dean Edward’s ‘Packer‘ class, ported to PHP by Nicholas Martin).
- Compresses the HTTP transfer via GZIP if available on the server.
- Caches parser output on the server to reduce server processing time.
You are free to download, modify and distribute this script for personal or commercial purposes under a modified MIT License provided that all original copyright and attribution information is distributed with the software.
- Edit the class.JSSqueeze.php file and set $debug_secret for secure debugging (only required for debug mode).
- Link the script to your HTML documents header with the following declaration:
For example, rename your jQuery or similar library script to ‘00.jquery-1.3.2.js‘, plugins to ‘10.jquery.pluginname.js‘ and your ‘$(document).ready()‘ or page related scripts can be upwards of ‘20.myscript.js’.
This allows you to debug your scripts with human readable data before publishing obfuscated data. For this reason, you can use the ‘developer’ versions (ie. Not minified or packed) of your 3rd party scripts for design-time debugging, but the production output will still be compressed and obfuscated.
To enable debugging, simply append ‘?debug=secret‘ to the script url (where secret is the value you set for $debug_secret) as follows:
Features in development
- Document priority tags to remove the need for files to be alphanumerically named