CSS Compressor
CSS Compressor is an online form that takes your CSS and compresses it down to reduce the filesize. A nifty little utility for those of you whose CSS is starting to get out of control.
CSS Compressor is an online form that takes your CSS and compresses it down to reduce the filesize. A nifty little utility for those of you whose CSS is starting to get out of control.
Good tool. But the CSS you get is very unclearly to work with. So I prefer larger CSS-files with a better overview. I think a linebreak after each selector and its defined properties would be needful.
By Björn Seibert on April 29, 2005 10:06 am
Well it does favor filesize over readability, but that is the point of compression I think. It should only be done once you have finalized the CSS. Not during the development process.
By Scrivs on April 29, 2005 10:28 am
That’s the point I thought about, too. So after finishing you compress it like this and upload it to your server and and leave another version with whitespaces offline for later re-designs etc.
Thanks for the tool-tip!
By Björn Seibert on April 29, 2005 10:37 am
No good if you need to use comment hacks etc. as it appears all comments are removed.
In the age of broadband - not sure the few ‘k’ you might save is worth it - tweaking and adjusting CSS would be a nightmare with the resulting code here.
By Dean on April 29, 2005 10:38 am
@Dean:
While I agree that the few k you might save is not necessarily worth it, I think the broadband argument is not so strong. If statistics are to be believed, only 56% of the US is surfing with a broadband connection and the numbers are not much higher world wide (in the 60s I think).
Also, I think you would always want to have a copy of the CSS file that is uncompressed for editing and compress before you upload to the server. I doubt you would want to tweak the compressed version.
This leaves only the nosey developer (and we all are, are we not) with the chore of somehow decompressing it (which probably is not all that difficult) if they wish to disect your code.
By Jason G on April 29, 2005 11:36 am
Neat! I like it. I don’t see myself using it, but that’s only because i’m constantly working on my CSS and I need to be able to read it!
I know it would only save a few kb here and there, but I imagine that would add up fast for a site with massive traffic, right?
By Jenni on April 29, 2005 11:56 am
Somebody should write a plug-in the performs that compression on-the-fly so you can edit your CSS as normal and let the server take care of optimization.
By Justin P on April 29, 2005 12:42 pm
There is already compression on-the-fly, at least for Apache. It works differently than this sort of compression, however. mod_gzip and mod_deflate both compression data before sending it for browsers that support it—which includes browsers as old as IE4! It’s a little surprising that it is not used more often when it works with almost all browsers and degrades gracefully in the rare case someone uses Netscape 3.5. If you are wondering whether your favorite site is using gzip or deflate compression, http://leknor.com/code/gziped.php is a convenient site.
By David Chen on April 29, 2005 1:06 pm
HTTP compression is different than this, I guess I should have clarified. Somebody should write a plug-in the does CSS optimization on-the-fly.
GZipping all server-client communication seems like overkill, but some people are quite adamant about it’s benefits. To me, relying on it could lead to some very sloppy CSS/HTML.
Before compressing, one should understand optimization.
By Justin P on April 29, 2005 2:26 pm
You simply keep a devlopment version commented up and compress the file when you copy to the live server.
You can keep a commented version of the file on live which people can look up if they find the URL in your HTML comments.
By Andy Hume on April 29, 2005 4:08 pm
Sounds like a maintenance nightmare if you ask me Andy, even on a small site that is adding 2 extra steps to every CSS update.
By Justin P on April 29, 2005 7:45 pm
TopStyle Pro has code sweepers which you can use to change the formatting of your CSS. I have a “super-readable” preset and an “ultra-compressed” preset set up - so when a site goes live I compress the CSS, and when I need to work on it again I just run the “readable” code sweeper. It’s a two-click process - very quick & simple.
By Kay Smoljak on April 30, 2005 9:09 am
well, gZipping i think does have its benefits. but really, it shouldn’t let you slack off on writing sloppy css.
one of the main reasons I’ve zipped our company css files is because they tend to get above 7k. Since I’m not entirely sure how http compression works, I do know that I get faster downloads. It’s confusing because the output still shows exactly what you wrote. I would imagine the crunches removes unneccessary line spaces, line breaks, and comments.
I’m sure a combination of both would surely do some great things.
By Dustin Diaz on May 1, 2005 7:57 pm
No good if you need to use comment hacks etc. as it appears all comments are removed.
In the age of broadband - not sure the few ‘k’ you might save is worth it - tweaking and adjusting CSS would be a nightmare with the resulting code here.
http://www.optimizehosting.com
By roderick on September 23, 2005 11:41 pm