Gzipping your CSS and JavaScript using PHP
You save your bandwith and speed up your site by gzipping your javascript code library and even your CSS, yes!
Basically if you slap this header on top of your CSS or JS file, it will be sent gzipped to the browser:
ob_start ("ob_gzhandler");
header("Content-type: text/javascript; charset: UTF-8");
header("Cache-Control: must-revalidate");
$offset = 60 * 60 ;
$ExpStr = "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset) . " GMT";
header($ExpStr);
The Definitive Post on Gzipping your CSS
Compressing Javascript with PHP
Comments: 1 Comment.
Comments
Comment from Patrick Fitzgerald - March 10, 2006 at 11:11
Nice, looks like you have all the bases covered. You might also be interested in my CSS/PHP color extensions: CSS Colors