I’ve followed the steps described at fiftyfoureleven.com and compressed my style sheet. The result is just fascinating:
- file size before: 6296 bytes
- file size compressed: 1885 bytes
That’s only 30% of the original file size! Wow! If 1000 people have visited your site, you’ve saved 4.2 MB of traffic. Just by compressing the CSS.
Add the following line to your .htaccess file:
AddHandler application/x-httpd-php .css
Then place this code snippet at the beginning of your CSS file:
$offset = 60 * 60 ;
$ExpStr = 'Expires: ' . gmdate("D, d M Y H:i:s", time() + $offset) . ' GMT';
The .htaccess modification is needed to make PHP parse the .css file. The code starts the compression.