laravel-html-minify icon indicating copy to clipboard operation
laravel-html-minify copied to clipboard

Issue with gulpfile

Open coffebar opened this issue 10 years ago • 15 comments

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>

coffebar avatar Aug 04 '15 21:08 coffebar

I'm having the same issue

MathieuUrstein avatar Aug 17 '15 23:08 MathieuUrstein

As am I

rappasoft avatar Sep 01 '15 03:09 rappasoft

And it's still an error

peshkov3 avatar Sep 07 '15 04:09 peshkov3

same here

pbean avatar Sep 14 '15 01:09 pbean

Indeed same here

will666 avatar Sep 30 '15 23:09 will666

same here

tibm avatar Nov 04 '15 16:11 tibm

+1

rappasoft avatar Dec 10 '15 22:12 rappasoft

+1

mp31415 avatar Dec 15 '15 19:12 mp31415

+1

AriaEdo avatar Dec 21 '15 04:12 AriaEdo

+1

timvanuum avatar Dec 21 '15 21:12 timvanuum

+1

bruno-farias avatar Jan 15 '16 04:01 bruno-farias

+1 ... Anyone got solution?

jAddict7 avatar Jan 15 '16 17:01 jAddict7

@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 avatar Jan 16 '16 03:01 peshkov3

@peshkov3 Thank you .. I will give a try ...

jAddict7 avatar Jan 17 '16 02:01 jAddict7

Anyone got a solution for this issue?

cardei avatar Apr 18 '16 11:04 cardei