gulp watch loop
rzb opened this issue · comments
Renato Zuma commented
After implementing gulp-htmlmin, gulp watch goes into an endless loop for me.
I'm on Laravel (elixir sits on top of gulp).
elixir.extend('compress', function() {
new elixir.Task('compress', function() {
return gulp.src('./storage/framework/views/*')
.pipe(htmlmin({
collapseWhitespace : true,
collapseInlineTagWhitespace : true,
removeAttributeQuotes : true,
removeComments : true,
minifyJS : true,
minifyCSS : true,
}))
.pipe(gulp.dest('./storage/framework/views/'));
})
.watch('./storage/framework/views/*');
});
shinnn commented
- Try some other HTML processor plugins inside
watch
task. If you can reproduce infinite loop even when you don't use gulp-htmlmin, this is an issue withelixir.Task#watch
. - If you cannot reproduce infinite loop with other plugins, pinpoint the HTML file that causes neverending process and open a new issue on https://github.com/kangax/html-minifier/issues with full content of the HTML file.
Brian Woodward commented
@rzb also it looks like your src and dest paths are the same. Since gulp-htmlmin
changes the files, watch
will trigger.
Renato Zuma commented
@doowb Yeah, I noticed that in the following morning with some coffee and have procrastinated since then.
I had copied that snippet directly from this laravel package repo, which is a server side solution to the same problem. So for those who end up here for the same reason:
Replace
.watch('./storage/framework/views/*');
With
.watch('./resources/views/**/*.blade.php');