This site compresses MooTools to about 20kb (the original file with YUI Compression weighing in at 65kb). Check it out!
This will literally take minutes to integrate.
- Download the PHP script.
- Upload the file to your active WordPress Theme folder.
- Create a folder called “cache” – Make sure this folder has proper permissions
- Create an .htaccess file in your theme folder.
- Create a folder called “css”
Making it Work
Insert the following code into your .htaccess file in your active theme. Make sure to replace RewriteBase with the absolute path to your theme folder where your combine.php script resides. Note that I made RewriteRule to be a relative path to combine.php:
You need to consider script dependencies, and chain your scripts accordingly. Also, make sure your stylesheets are added in the correct order or you may notice some rules being overridden. Depending on your server configuration you might have to chmod your cache folder to 777. Confirm that your cache folder contains your cached files with a ‘.gzip’ extension.
All CSS files are moved to the CSS folder in the theme. This goes against the WordPress convention of style.css in the theme’s main folder. I still have theme comment data for WordPress in my original style.css file, but I don’t use it on my site.
Major hat-tip to Niels Leenheer for creating such a great script and simple solution.