Posted By

yves on 06/30/10


Tagged

css php compress


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

colingardom
manavecplan


Compress CSS with PHP


 / Published in: PHP
 

URL: http://css-tricks.com/snippets/css/compress-css-with-php/

Start your CSS files with the following PHP (and name it style.php)

include it with:

  1. <?php
  2. ob_start ("ob_gzhandler");
  3. header("Content-type: text/css; charset: UTF-8");
  4. header("Cache-Control: must-revalidate");
  5. $offset = 60 * 60 ;
  6. $ExpStr = "Expires: " .
  7. gmdate("D, d M Y H:i:s",
  8. time() + $offset) . " GMT";
  9. header($ExpStr);
  10. ?>
  11.  
  12. body { color: red; }

Report this snippet  

You need to login to post a comment.