I do not recommend this in any parallel dimension that may exist, but somehow i was forced to do the following:
I first created a minimiseCSS() function under functions.php
function minimiseCSS($css){
$css = preg_replace('/\/\*((?!\*\/).)*\*\//','',$css); // negative look ahead
$css = preg_replace('/\s{2,}/',' ',$css);
$css = preg_replace('/\s*([:;{}])\s*/','$1',$css);
$css = preg_replace('/;}/','}',$css);
return $css;
}
Then, the part where I don’t feel comfortable with and don’t advise, is going to /wp-content/plugins/wp-add-custom-css/css/custom-css.php and modify line 6:
// change the below
echo $custom_css;
// to the following:
echo minimiseCss($custom_css);
I hope this helps other SEO overachievers out there ??
-
This reply was modified 4 years, 9 months ago by amjo31.