Compress CSS with PHP


/ Published in: PHP
Save to your folder(s)

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

include it with:


Copy this code and paste it in your HTML
  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; }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.