fitztrev / laravel-html-minify

Minifies the HTML output of Laravel 4 applications
https://github.com/fitztrev/laravel-html-minify/wiki/Laravel-5---5.1-HTML-Minifying
MIT License
415 stars 76 forks source link

Regarding your notice #54

Closed dhardtke closed 9 years ago

dhardtke commented 9 years ago

Hi,

you recently started recommending "gulp-htmlmin" and a custom gulpfile.js for minifying Laravel's compiled views, but it's not working well...

[21:44:22] Starting 'compress'...

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: Parse Error: <li<?php echo Request::is("ucp") || Request::is("/") ? ' class="active"' : ''; ?>>

I just wanted to tell you and other people that htmlmin is not always a solution, at least not in my case where I have Blade tags inside the HTML, like

<li{{ Request::is("/") ? ' class="active"' : ""}}>
baribadamshin commented 9 years ago

I'm disappointed. Minification really doesn't work with php into html attributes

xavadu commented 9 years ago

Hello,

It isn't a suitable solution in most of the cases, when you work in your project and later you upload it to a git repository, the storage folder isn't uploaded, and usually you run the javascript task on the deployment process, not later to visit your page to generate the cache views.

It will be a bad practice to upload the content of your storage folder, and also can happen that not all the view of your site are cached, or maybe the cache get updated with a new file.

fitztrev commented 9 years ago

@xavadu I have a command I wrote that recompiles all the blade templates without having to visit/load the page. It uses Blade::compile($file); and you can just write a loop that passes in all your templates files (File::allFiles(base_path().'/resources/views/')).

IMO, the Gulp task is a much better approach than using the PHP package. I've been using it for the past 6 months or so.

acacha commented 8 years ago

What about first comment of @dhardtke? I have a lot of parse errors too so anybody have a solution?