Discover the best of the web!
Learn more about Digg by taking the tour.
CSS Tweak! - Get those CSS file sizes down
cssdev.com — CSS Tweak is a web based CSS optimization tool. It will take any CSS file and optimize the syntax, grouping your style declarations into shorthand where possible. It can also remove comments, and strip whitespace for maximum compression.
- 930 diggs
- digg it
- en3r0, on 10/12/2007, -56/+25Great find, this is a good tool. + Digg!
___________
-en3r0
http://virtenu.com- Windsinger, on 10/12/2007, -43/+7What idiots are undigging this comment? Morons.
- ForbesBingley, on 10/12/2007, -37/+6I think we need another filter option.
Ideally, one that strips out all of the excessive brain-dead unDiggers we seem to be amassing like tooth plaque... - Junto, on 10/12/2007, -3/+25It's probably receiving negative feedback because the author has linked to his personal site. Logically, if Digg was supposed to support signatures and self advertising then we would be able to set them easily in our preferences and auto post our signatures when we reply. Since Digg doesn't offer such a feature, QED, I'm guessing that most users tend to feel that the only situation links should appear in comments is when they support the comment thread or news story. It would get pretty annoying if we all started using signatures that link to our own lame personal blogs.
- sethkinast, on 10/12/2007, -6/+15I go through and undigg every comment I can find that includes spam links.
- casiotone, on 10/12/2007, -4/+7junto: this is exactly why I undigg comments like this. You're supposed to be making comments, not advertising your lame site that nobody cares about. I don't read comments to get a free iPod.
- Bogtha, on 10/12/2007, -3/+2I buried the comment because it's pointless. If you think it's a worthwhile article, that's what clicking on 'Digg' is for. You don't need to follow up with a comment telling everybody you've dugg it.
Now if you say something like 'I like this article because...", then that's a different matter. There's a point to comments like that. But just "I like this article" on its own is completely useless.
- daedal, on 10/12/2007, -17/+7Dug? Site's not loading up on my end.
I'll try again later.
Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at localhost. This could mean your host's database server is down. - idiggeverything, on 10/12/2007, -17/+4Tis dead.
- Reliant, on 10/12/2007, -14/+4Digg effect! Site is either extremely slow or down with same note in above comment.
- nvidiafx, on 10/12/2007, -13/+4the digg effect. wordpress goes down. i guess i need to wait for a while.
- jboi, on 10/12/2007, -14/+9Or digg detection to save money, server & bandwidth :)
if ondiggfrontpage
response.redirect errorpage.htm - TheCheeta, on 10/12/2007, -0/+6I assume that people that use a tool like this have a copy of the CSS that they actually work from for editing? Otherwise, that would really suck to have to go in there and find that one obscure style for editing.
- lkd123, on 10/12/2007, -6/+10umm, one of its tweaks is to delete comments. No thanks...
- hagrin, on 10/12/2007, -0/+12Well, I think you're missing the point of development vs. production.
You can run the optimizer on the code you plan to publish to your production box only - you wouldn't run this code on your development machines/code. So for instance, when I release changes to any of the web applications we have built here, it runs through an optimizer first and then copies the changed files to the web server.
You're right - your code having proper comments is essential; however, you don't need site visitors to read your comments stating "IE Bug Fix Code Here". - DJNewStyle, on 10/12/2007, -0/+8It's kind of like compiling a program..
Keep a copy of the commented, spaced out, formatted source.. upload the "compiled"/tweaked copy. - lkd123, on 10/12/2007, -0/+4well, guess i just showed my ignorance (yet again). Thanks for the patient response
- jbno, on 10/12/2007, -2/+4No kidding—and no, I'm not missing the point between production and development. CSS isn't a programming language and it's not like compiling source code to an executable (or even some kind of intermediate code). I doubt anyone's CSS is so large that the value of making the CSS smaller outweighs creating hard-to-read CSS that requires another set of files (the ones with the comments, the longer property names, and the whitespace characters) to maintain. This strikes me as a remarkably bad tradeoff.
Better to do as another poster said and use on-the-fly compression on the server with mod_gzip or somesuch program. That 20k CSS file will get compressed before it goes to the client and you'll keep your ostensibly readable CSS file where it is most likely to be seen by site maintainers in the future (which may be you long after you've forgotten about what you did on a particular site, or long after you've learned enough to not make the same mistakes you once did). Also, consider redesigning the CSS so it is broken up amongst more than one file which are loaded as needed.
"Every little bit" doesn't count. You need to make smarter choices about bigger issues and don't sweat the small stuff. You've got better things to do. - GeneralFailure, on 10/12/2007, -0/+5jbno: The CSS file on my server uses over 100MB of bandwidth per day. Condensing helps if you actually have traffic.
- jbno, on 10/12/2007, -0/+0GeneralFailure: Where can one find the website whose CSS is 100+MB/day of traffic, your information relating server-side compression to near-obfuscation (what you refer to as "condensation") of the CSS?
Also, one ought to consider if using the shorter CSS properties has unpleasant side effects for browsers still in use with poor support for such properties. This is an underdiscussed problem here.
- hagrin, on 10/12/2007, -0/+12Well, I think you're missing the point of development vs. production.
- patricks, on 10/12/2007, -0/+17Obviously you would keep a local copy to actually work with that would have your intact css and comments.
This is essentially doing the same thing a javascript compressor does. Like a javascript compressor, you would never try to actualy edit the compressed JS, but rather the original file. - eth3l, on 10/12/2007, -14/+1Digg Effect
- GrahamStw, on 10/12/2007, -1/+7Link doesn't work, but is there really much point to doing this??
Okay so you might cut a little fat off your CSS file, but is that worth doing at the expense of readability?
There is no perceptible difference in download speed between a 1kB and a 2kB CSS file. Plus if you are using HTTP compression (such as mod_gzip) then it is even more pointless, because the file will be compressed anyway.- patricks, on 10/12/2007, -1/+8If you've got a 2kb css file and HTTP compression then don't bother.
A lot of people don't have that though. Consider a 10 or 20k css file with no compression. Then consider this site getting several thousand hits a day. Now consider the bandwith that can be saved by turning that 20k file into a 6 or 7k file. - Run4yourlives, on 10/12/2007, -0/+4On a high traffic website it matters... every little bit counts.
- dasil003, on 10/12/2007, -0/+4mod_gzip is pretty much standard. If your host doesn't run that, then optimizing your CSS file isn't even worth consideration til you get mod_gzip running.
The idea that 'every little bit counts' is false. Whether optimizing filesize or performance, you had best profile your existing usage first. CSS files are cached by the browser, and are often much smaller than HTML documents (let alone images). If your log analysis gives you URLs ranked by total bandwidth usage you can see what you should be optimizing first. If you're using 20GB of bandwidth a month and 50MB are going to CSS, you're not going to make much of a dent.
Of course it doesn't hurt if you can set it up in a relatively automated fashion. Personally it wouldn't work for me, because I often tweak things on the live server via ssh then rsync the differences. Then again I host with Dreamhost and Site5 where CPU usage is far and away the biggest resources usage concern.
- patricks, on 10/12/2007, -1/+8If you've got a 2kb css file and HTTP compression then don't bother.
- adaptive, on 10/12/2007, -0/+10I have been using this for a while http://cdburnerxp.se/cssparse/css_optimiser.php
- GrinningFool, on 10/12/2007, -4/+4Y'all can bury him if you want, but he's got a valid point. A Scripting category would be nice.
- mantorp, on 10/12/2007, -1/+3I just found http://psyc.horm.org the other day, dead simple to use. Yeah yeah not an optimizer, more of a CSS creator, but it's cool.
- wetelectric, on 10/12/2007, -13/+11Honestly.... css,javascript,php, html, corners, shadows, 'web 2.0' gah! Im tired of seeing god damn scripting languages in the programming section. It would be good if digg had a seperate section for this bollocks. Put section name ideas below:
- patricks, on 10/12/2007, -5/+3Agreed, a scripting category would be a nice addition.
Also, sorry grinningfool. Meant to +1 ya not -1 ya. - barryfandango, on 10/12/2007, -1/+7I think Programming should definitely include javascript, ruby, python - if i want to discuss an algorithm implemented in C or javascript, what does matter if one is compiled and one interpreted? OTOH, I agree about CSS and HTML, as these are markup and not programming languages. As for those that blur the lines, like XSLT, I'm on the fence.
- patricks, on 10/12/2007, -5/+3Agreed, a scripting category would be a nice addition.
- kevin45, on 10/12/2007, -10/+1Lame. If you know what you're doing the css file won't be that big anyway. Theres too much risk of losing/overwriting the original from habitual working/saving/working/saving often.
- frontpage, on 10/12/2007, -2/+5Here's a non-wordpress link that seems to be alive: http://www.cssdev.com/csstweak/
- kevin45, on 10/12/2007, -8/+4Lol @ patricks -1 digging anyone who doesn't like this junk.
- flump, on 10/12/2007, -2/+5The original css optimiser (mine) http://flumpcakes.co.uk/css/optimiser/
Has options for printing in a readable and more compressed format (among many others).- Marshy, on 10/12/2007, -0/+2just asking why is a woman assuming "the position"? do you have a dominant personality...?
- lalindsey, on 10/12/2007, -0/+1or she is a woman and likes to be manhandled
- AhmedF, on 10/12/2007, -2/+4Reminds me of http://www.cssoptimiser.com (which was front-page dugg).
- watson1987, on 10/12/2007, -0/+1We need programs like this for other things too (HTML, regular languages, batch files etc)
Lots of things like blank lines, tabs, comments really add up
I like how this is advance and actually groups stuff- barryfandango, on 10/12/2007, -0/+4Here's one for minimizing javascript: http://www.crockford.com/javascript/jsmin.html
- watson1987, on 10/12/2007, -2/+0thanks - didn't know :)
- weiran, on 10/12/2007, -0/+4Just turning on gzipping on your server would probably give most of the advantages this would give you. Anyway, most browers also cache CSS, so I can't see that being the main bandwidth hog.
- NoDude, on 10/12/2007, -2/+2Shame nobody mentioned TopStyle Pro's style sweeper. At least it didn't mess up my hacks like this... tool (pun intended here). And if you tweak it for a couple of minutes you can get the same results as the last few optimizers mentioned. Only better.
- Tarec, on 10/12/2007, -5/+1Too bad the site is down...
- rYno, on 10/12/2007, -6/+3This Account Has Been Suspended
bandwidth overload! lol - Ckwop, on 10/12/2007, -2/+2Why not keep the file the same as it is and use the HTTP/1.1 standard GZIP compression to transport it to the browser?
You can even cache the compressed file in memory so that you don't have the CPU overhead of gziping it each time.
It seems pretty useless to me.
Simon - ThePhilomath, on 10/12/2007, -8/+1This was posted ages ago, sigh. DUPE.
- SilverRocket, on 10/12/2007, -1/+5Ckwop: here's why:
Internet Explorer May Lose the First 2,048 Bytes of Data That Are Sent Back from a Web Server That Uses HTTP Compression
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q313712
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q312496 - Marshy, on 10/12/2007, -8/+2then ***** IE
- quade, on 10/12/2007, -1/+2In about 5 years after IE7 comes out, the IE6 marketshare will proabably be low enough that we can, and won't have to support that POS anymore.
- Magadass, on 10/12/2007, -3/+0Im not sure a couple of k would make a big difference! I mean seriously, especially since the browser most likely doesnt pull down the entire css file if its a linked one, but instead it just parses out what it needs. Now I know the inline ones are merged into the page but has anyone ever given any observation as to how the linked css files are parsed? It wouldnt make much sense to pull the entire thing down really! Why would you need to?
- gorkish, on 10/12/2007, -0/+2Very little of this makes much difference if you use mod_gzip or similar to compress outgoing content. Yes you can strip out and optimize all of your code into unreadable junk if you want to, but it's not going to load particularly faster or save you a huge amount of money unless you are serving millions and millions of pages per day. And even at that you shouldn't trust an automated tool to do the right thing. Even reordering CSS can screw you up due to very esoteric browser behaviors.
- therernospoons, on 10/12/2007, -0/+1Wish I can undigg this. The link is pointed to some page we may as call dead. On top of that nyud.net is mirroring the "dead" page.
- nipto, on 10/26/2007, -0/+0Here's a much better CSS Tweaker / Compressor / Optimiser:
http://csstweaker.com - monkeywaffles, on 12/31/2007, -0/+1Well, the site is down
You know what works even better? A new program http://www.artofscaling.com/14/css-minification/ which not only removes whitespace, etc, but also groups multiply used css elements to compress even further than any others.
