My name is Rob Cherny and I'm a professional Web Developer with 16 years of experience creating Web sites and Web-based applications. This site is where I write about my work, and random other things...

Learn More


Close Tab

Web Development

CSS and JS Compression on the Server

Just a quick note and heads up, if anything is amiss here:

I’ve been really messing around with some configuration settings on lately, mainly testing some performance tweaks for another project, and well, this site pays the price.

So if anything’s horked, yeah, I broke it and hope to be back at this soon to fix it.

Main thing I’m curious about is if any actual visitors to the site have browsers which choke on the server-side compression I’ve been toying with on the CSS and JS files. Please comment if you do.

I’m anticipating NS4 having some issues, but I don’t think I have a lot of those visitors.

Main technique I’ve been messing with has been described previously on this site and others. Some of it I’d blogged about via others as well.

I admit I fairly much slapped together the version here, but I cut the CSS from 20KB to 5KB and the JavaScript from 20KB to 10KB. Not bad, but I freely admit a more responsible testing process should be followed if this was a production or e-commerce site.

I had combined all the CSS files, but interestingly enough, the printer CSS, embedded in the main CSS file with an “@media print” statement immediately choked IE5. Not that (a) I’m certain I did that right or (b) that I even have a large IE5 audience.

And, this is pure server-side compression, the CSS files and JS files could have all the white space squeezed out as well, but I’ve done that, and this was a test of something new.

Please drop me a comment if the site blows up for you, I’ll be revisiting this at some point and plan on tweaking it more. Hey, on the up side, on crappy dial-up the site should load in a blazing 16 seconds or so. Wow. Heh. C’mon people.

Jun 2, 04:39 PM in Web Development (filed under ChernyCom, Web101)

  1. Milan Negovan    Jun 4, 12:47 PM    #

    Rob, everything looks fine. Speaking of various CSS hacks, here’s an immensely helpful matrix: css hacks

  2. Milan Negovan    Jun 4, 12:51 PM    #

    Btw, if you serve this blog deflate- or gzip- compressed, you can cut down the payload by 67%, according to my tool :)

  3. rob    Jun 5, 03:21 PM    #

    Hey Milan, thanks for checking.

    In terms of CSS hacks, yeah, Kevin Smith’s (Centricle) resource is still something I check on a regular basis. The @media support listed there didn’t show IE choking, which is why I was surprised. I’m sure I did something wrong in my rush.

    Nothing here is final for the moment tho ;-)

    You know I haven’t seen your tool for analyzing the HTML content compression before. As your tool states at the top, yeah, browsers have quirky support for compressed CSS and JS, which was the point of my hastily put together post. Like I said, I’ve been testing for another project, but I’ve actually had to set it aside for a few days. I’d hate to think the site was busted for someone :)

    So yes, I should look at the HTML compression too. The site’s served up by Textpattern, so I’d have to investigate .htaccess doing something in conjunction with it.

    Great tool, by the way. Most excellent.

    Thank for your response!

Commenting is closed for this article.

In This Section