Skip to content

Instantly share code, notes, and snippets.

@alfrekjv
Created May 9, 2012 19:53
Show Gist options
  • Save alfrekjv/2648351 to your computer and use it in GitHub Desktop.
Save alfrekjv/2648351 to your computer and use it in GitHub Desktop.
Gzip on the fly -- PPI
<?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