Minimising the time a client needs to sit tight for a site page to load is significant. Utilizing Gzip and Php we can minimise document sizes of Css records. This method is a compelling and basic path to lessen page download examine and speed your webpage that will work with generally Php establishments, even those on imparted hosting that don’t have mod_deflate turned on in their Apache setup.
Just add the code below at the top of your page. You then need to change the links to point to your CSS files.
if(extension_loaded(‘zlib’)){
ob_start(‘ob_gzhandler’);
}
header (“content-type: text/css; charset: UTF-8”);
header (“cache-control: must-revalidate”);
$offset = 60 * 60;
$expire = “expires: ” . gmdate (“D, d M Y H:i:s”, time() + $offset) . ” GMT”;
header ($expire);
ob_start(“compress”);
function compress($buffer) {
// remove comments
$buffer = preg_replace(‘!/*[^*]**+([^/][^*]**+)*/!’, ”, $buffer);
return $buffer;
}
// list CSS files or JS to be included in the Gzip
include(‘global.css’);
include(‘style.css’);
if(extension_loaded(‘zlib’)){
ob_end_flush();
}
tumblr dofollow links
nnivhxhue ltqxj ebjlfhp lkjo owofhjmrmhrmzzx