WP-CSS-Streamliner: CSS optimization plugin for WordPress
This post serves as a 'homepage' for WP-CSS-Streamliner, a WordPress plugin that will greatly enhance the client-side performance of your WordPress site. The plugin was originally written as a showcase example in my article named 'On a quest for ultimate website performance' in which I describe several techniques that help improve the performance of your website. Read it to find out what the purpose of this plugin really is.
Features
WP-CSS-Streamliner has the following features:
- Grabs all <link> tags from your pages in real-time and transforms them into one new one pointing to a highly optimized combined CSS file
- Performs gzip compression on the optimized CSS file
- Exclude mechanism to keep certain CSS out of the optimization process, for example print CSS files, alternate stylesheets or IE specific CSS within conditional comments
- Caches different combinations of CSS on a per-page basis. Every combination will be cached and served once
- Rewrites image URL's in CSS to absolute ones in order to make CSS coming from different directories still work properly when served from one location
- Automatically excludes CSS served from other hosts (no need to use the exclude mechanism for this)
- Force-refresh option to refresh the cache in case of trouble
For more information, read the README.txt provided in the archive.
Compatibility
The All-In-One-SEO-Pack plugin breaks your site when used in combination with WP-CSS-Streamliner. I think it's not WP-CSS-Streamliner's fault but I'm going to look into it later.
WP-CSS-Streamliner was developed on WordPress 2.1.x and should work on any 2.x version. In case you encounter trouble, let me know about it and I'll try to fix it.
HELP! It doesn't work!
In case the plugin results in broken pages or other undesired effects, do the following:
- In rare cases the caching process results in broken CSS. This happens when a visitor calls the page at the exact moment when one of your CSS files is being updated on disk. Call your page again in your browser with ?refresh appended. It will refresh the cache.
- Read the README.txt if you hadn't already. If you did, read it again. There's troubleshooting hints in there.
- Exclude all CSS through the exclusion mechanism by adding them to nocompress.inc and remove them one by one, starting with your main CSS file. This will help you find the troublesome CSS file. If it's an IE specific CSS file, an alternate CSS file or a print CSS file, leave it out. If it's something else I'd love to hear about it.
- Check if files are being created in your wp-content directory. They should look like c9a61def0d2950b10d8078b605290622.css. Check what's in it. The files should contain highly compressed CSS.
- If all this fails or brings up clues about a bug, post a comment below this post.
Current version and download
The current version is: 1.0.3.
Filed under: reads
Number of comments:
Number of trackbacks:
Tagged with: 








At 01 June '07 - 05:26 Marcos wrote:
At 08 June '07 - 00:05 Ozh wrote:
I use something similar on my blog which was made from the following article :
http://rakaz.nl/item/make_your_pages_loa..
supports CSS and JS, and supports various browser bugs (for instance, some versions of IE can’t read gzipped content)
At 08 June '07 - 00:33 Marco wrote:
However not so easy to use on WordPress because you’d have to edit all plugins to remove their insertion of link tags pointing to CSS files. This is one of the things I wanted to prevent or too many people wouldn’t know how to use my plugin. I wanted to make sure that no WP (plugin) files need to be edited in order to use the plugin. There’s just the exclusion array to modify. Also, this script assumes all CSS files are in the same directory. If not it will cause images to not load anymore because the merged CSS is served from one location. I took care of that issue as well.
I like the check for gzip compatibility even though hardly anyone surfs with those browsers and most WP sites would break on them anyway (because most themes and scripts aren’t compatible with them). I think I’ll add it to the next version.
At 08 June '07 - 00:58 Ozh wrote:
At 09 June '07 - 05:03 DaveMc wrote:
Dave
At 10 June '07 - 13:58 tash wrote:
I had a css-compress plugin I was using that would gzip the contents of the css but turning it into one css file would be great too.
At 10 June '07 - 14:06 Marco wrote:
At 10 June '07 - 14:40 tash wrote:
At 10 June '07 - 17:58 Marco wrote:
At 10 July '07 - 02:40 jez wrote:
[...]
the corresponding end tag to compress my css and somehow this delivers smaller results than your plugin (thanks for releasing it!!!).
what compression routine do you use?
At 25 July '07 - 11:28 Joe wrote:
At 07 August '07 - 13:22 Joe wrote:
Warning: Invalid argument supplied for foreach() in /home/[path removed]/wp-content/plugins/WP-CSS-Streamliner/wp_css_streamliner.php on line 128
At 05 November '08 - 09:38 MrPete wrote:
At 31 July '09 - 12:01 SamuraiMarine wrote: