Skip to content

Instantly share code, notes, and snippets.

@mazhar266
Created April 12, 2012 10:22
Show Gist options
  • Save mazhar266/db366be222326926916c to your computer and use it in GitHub Desktop.
Save mazhar266/db366be222326926916c to your computer and use it in GitHub Desktop.
CSS Compress
<?php
header('Content-type: text/css');
ob_start("compress");
function compress($buffer) {
/* remove comments */
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
/* remove tabs, spaces, newlines, etc. */
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer);
return $buffer;
}
/* your css files */
include('master.css');
include('typography.css');
include('grid.css');
include('print.css');
include('handheld.css');
ob_end_flush();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment