Created
May 9, 2012 19:53
-
-
Save alfrekjv/2648351 to your computer and use it in GitHub Desktop.
Gzip on the fly -- PPI
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 | |
$generic = array('bootstrap.min','layout','website'); | |
$files = array_merge($generic, $core['files']['css']); | |
foreach($files as $file): | |
$path = 'css/' . $file; | |
$gzipped = $path . '.css.cgz'; | |
if (!file_exists($gzipped)) { | |
$fdata = file_get_contents($path . '.css'); | |
file_put_contents($gzipped, gzencode($fdata, 9)); | |
} | |
?> | |
<link type="text/css" href="<?php echo $baseUrl; ?>css/<?=$file; ?>.css.cgz" rel='stylesheet' /> | |
<?php endforeach; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment