Hi, i am trying to minify html output:
1. Create a PHP file (minify.php), with code:
<?php
function sanitize_output($buffer) {
$search = [
'/\>[^\S ]+/s',
'/[^\S ]+\</s',
'/(\s)+/s',
'/<!--(.|\s)*?-->/'
];
$replace = [
'>',
'<',
'\\1',
''
];
$buffer = preg_replace($search, $replace, $buffer);
return $buffer;
}
ob_start("sanitize_output");
?>
2. in globaltemplate before <!DOCTYPE html>, i added:
{{require "minify.php";}}
But it's not working.....
Please how to Minify html output??