laravel-html-minify
laravel-html-minify copied to clipboard
Watching creates an infinite loop
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)?
+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 ! :)
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.