Compress your CSS

A great way to help with performance of your website is to compress (or minify) your CSS and javascript. Removing spaces, comments, etc will shrink the size of your files which will decrease the payload of your page.  Usually the larger your site the larger your CSS will be.

The only disadvantage to compress your CSS is maintenance (since your entire CSS file ends up on one line it’s difficult to read/maintain).My approach to this is to have 2 CSS files in your project, one compressed and the other not.  I have my code reference the compressed file.  When changes are needed I update the non-compressed file, recompress, copy and paste the results over the compressed file.

Of course you only need to compress your CSS files when you move to production.

Here is a link to site that will compress your CSS

They have a link that will compress your javascript using YUI compressor or Microsoft Ajax Minifier.


2 thoughts on “Compress your CSS

Got something to add?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s