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

Watching creates an infinite loop

Open viki53 opened this issue 8 years ago • 2 comments

Hi,

I'm just getting started in the Laravel world, and I'm trying to use this plugin too.

When I use it with gulp watch, this creates an infinite loop, as every time a view is compressed, it is seen as changed so it gets compressed again… and again… and again… you see the point.

Is there any way to avoid that? Maybe by not compressing a view that's already compressed (eg. if weight is the same after and before, just not save it)?

viki53 avatar Jun 26 '16 13:06 viki53

+1 Same here.

EDIT: I use this elixir.extend('compress', function() { new elixir.Task('compress', function() { return gulp.src('./storage/framework/views/*') .pipe(htmlmin({ collapseWhitespace: true, removeAttributeQuotes: true, removeComments: true, minifyJS: true, })) .pipe(gulp.dest('./storage/framework/views/')); }) .watch('./resources/views/**/*.blade.php'); });

Then in elixir function i add .compress and wokrs ! :)

alanaasmaa avatar Aug 22 '16 16:08 alanaasmaa

The solution above solves the infinite loop, but creates another problem: the view cache is not updated, so you'll never see changes in your code.

rzb avatar Feb 21 '17 09:02 rzb