laravel-html-minify
laravel-html-minify copied to clipboard
Issue with gulpfile
I'm trying to use this https://github.com/fitztrev/laravel-html-minify/wiki/Laravel-5---5.1-HTML-Minifying
but something wrong
[00:08:35] Starting 'compress'...
events.js:72
throw er; // Unhandled 'error' event
^
Error: Parse Error: <link rel="stylesheet" href="<?php echo e(elixir("css/all.css")); ?>">
file: somethng like this
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?php echo $title; ?></title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1' name='viewport'>
<link rel="stylesheet" href="<?php echo e(elixir("css/all.css")); ?>">
<meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">
<link rel="icon" href="<?php echo e(asset("/images/my.ico")); ?>" type="image/x-icon" />
<?php echo $__env->yieldContent('head'); ?>
</head>
<body> ...</body>
</html>
I'm having the same issue
As am I
And it's still an error
same here
Indeed same here
same here
+1
+1
+1
+1
+1
+1 ... Anyone got solution?
@jAddict7, I use middleware, which contain following handle method:
public function handle($request, Closure $next)
{
$response = $next($request);
if ($response instanceof \Illuminate\Http\Response) {
$output = $response->getContent();
$output = preg_replace('/<!--([^\[|(<!)].*)/', '', $output);
$output = preg_replace('/(?<!\S)\/\/\s*[^\r\n]*/', '', $output);
// Clean Whitespace
// I've commented this line because it was cuting some html
// $output = preg_replace('/\s{2,}/', '', $output);
$output = preg_replace('/(\r?\n)/', '', $output);
$response->setContent($output);
}
return $response;
}
You can find this solution in the web
@peshkov3 Thank you .. I will give a try ...
Anyone got a solution for this issue?