php - Compressed HTML in Laravel still contains whitespace -
php - Compressed HTML in Laravel still contains whitespace -
i using below code compress html output in laravel; set in filters/app::after function
if (app::environment() != 'local') { if ($response instanceof illuminate\http\response) { $output = $response->getoriginalcontent(); // clean comments $output = preg_replace('/<!--([^\[|(<!)].*)/', '', $output); $output = preg_replace('/(?<!\s)\/\/\s*[^\r\n]*/', '', $output); // clean whitespace $output = preg_replace('/\s{2,}/', '', $output); $output = preg_replace('/(\r?\n)/', '', $output); $response->setcontent($output); } }
but character "à" symbol: � instead. tried remove line:
$output = preg_replace('/\s{2,}/', '', $output);
it fixed symbol error, html output not work (some white space not removed). can help me?
php laravel-4
Comments
Post a Comment