Web Design

Minify CSS and Javascript with YSlow

Beating rule #10 is easy. We want to serve CSS and Javascript that has been minified (and obfuscated, if you please) to our readers, because that’s less overhead for them ...

Beating rule #10 is easy. We want to serve CSS and Javascript that has been minified (and obfuscated, if you please) to our readers, because that’s less overhead for them to download. We also want to do it without screwing up our code, so I recommend using Yahoo!’s UI Compressor.

Now, would-be ultra- “l33t” programmers might enjoy using a command line, but I sure don’t. It’s a waste of the time Darwinian evolution spent on developing my eyeballs. Instead, swing on by to this cool guy’s website, http://refresh-sf.com/yui/, where you can just copy paste your CSS or JS into a text field and get it minified/obfuscated without fiddling with Stone Age command prompts.

What happens when we have to make changes to our files after they’ve been minified/obfuscated? Well, that’s what a development environment is for, and is something to talk about later.

* Keep one thing in mind when you minify/obfuscate: comments get stripped out entirely, and usually the software license or developer credit for freeware is contained in those comments. After some meditation on this matter, I decided that it’s silly to keep the comments in after minification; that would be doing it half-assed and ultimately it defeats the purpose. As a compromise, we should have a page in our website that credits the creator of source code we borrow from the open source community. This provides even more visibility for our open source colleagues while allowing us to fully minify our files.


YUI Performance Rules

Mastering Yahoo's Performance Rules


Post a Comment

Your Two Cents

Reply

Your Comments

3 Replies & Counting

  1. dquinn 8 years, 5 months ago

    Thanks for noting this. Very helpful in keeping the license information.