Created
July 26, 2010 19:23
-
-
Save envex/491083 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
This file takes all of our css files, compresses and combines them into 1 nice file | |
This is not my original script, I found and modified it. | |
I can't remember where I found it though, it's been a while :/ | |
Usage: | |
<link rel="stylesheet" href="/inc/css/compress.php" type="text/css" media="screen" /> | |
*/ | |
header('Content-type: text/css'); | |
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; | |
} | |
ob_start("compress"); | |
//Default CSS | |
include('reset.css'); | |
include('main.css'); | |
ob_end_flush(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment