Compress CSS with PHP

Submitted by:Jhon Smith

Date added:29 October, 2011

Category:CSS

Here shown an example how to Compress CSS with PHP

Tags: compress css

Code Snippet:

<---- Start your CSS files with this PHP (and name it style.php):   ---->

<?php
ob_start ("ob_gzhandler");
header("Content-type: text/css; 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);
?>
body { color: red; }


<----- Then call your CSS with the PHP file name: ----->

<link rel='stylesheet' type='text/css' href='css/style.php' />
 
 

Comments