Comprimir CSS con PHP | Programar Plus

Inicie sus archivos CSS con este PHP (y asígnele el nombre 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; }

Luego llame a su CSS con el nombre de archivo PHP:

<link rel="stylesheet" type="text/css" href="https://css-tricks.com/snippets/css/compress-css-with-php/css/style.php" />