Home arrow Blog arrow How to Super Compress Mootools

How to Super Compress Mootools

E-mail
(5 votes)
Written by Rick Winkler   
Sunday, 16 March 2008
Mootools can provide a number of great enhancements to your site. Mootools.net provides an excellent downloader that allows you to obtain a custom package with only the components you need. By default, the downloader will compress the file using the YUI Compressor. This compressor does a pretty good job, but we can do better.

22-1-thumb.png 1. Head over to the download section at Mootools.net. Select the components you will be using. If you are unsure which components you need, select them all.  In the “Choose compression type” section at the bottom, select “No Compression”, then click “Download” and save the file.

2. Head over to Dojo ShrinkSafe. Browse to the freshly downloaded Mootools file, select it, and then click the “shrink em!” button. Save the new file.

3. Head over to Dean Edward’s Packer. Open the file saved from Dojo ShrinkSafe in a text editor. Copy and paste the contents of that file into Packer. Select the “Base62 encode” and “Shrink variables” options and click “Pack”. Copy the output to a new file and save.

You now have a super compressed Mootools script. By selecting all components and using the default YUI compressor yields a file that is 66,079B. Using the above method yields a file that is 40,189B, which is almost a 40% improvement.

If you have followed other articles involving Joomla and Mootools, you can use this process to generate an optimized mootools.js file. You can also pretty much run any javascript code through this process. I did run into one third party script which encountered errors when used, and those errors where caused by poor coding of the script. Fixing the errors in the non compressed script solved the problem.
Bookmark This: 
Comments Add            Search            
2 0
Thanks Man
I wasnt figuring out the way
0 0
Thanks very much for this Tutorial!!
0 0
I can only find Dojo ShrinkSafe for Mac OS. Do they have a windows version?
0 0
The link in the article is the online version. It should work on any OS.
0 0
Shrinksafe does not work for me? I get a kind of error all the time ...
3 0
Can you provide your compressed mootool.js for download? ShrinkSafe is down.

Thanks,
Anthony
1 0
If shrinksafe doesn't work for you its because you need to change the .txt file you downloaded from mootools.net to .js Once you have done that you will find that the compression system works just fine. I am slowly chipping away my page size http://gnuventure.com/

Rick thanks again for your help
0 0
After going through the process mentioned above I found that my drop down menus no longer worked in my back end. I decided to try the same compression with the file that comes with joomla and I found it to solve the problem. The file ended up being about 44k, much better than the original file.
Add Comment
Name:
Comment:
 
Security Image
Please input the anti-spam code that you can read in the image.