I'm trying to minify my HTML. I've just discovered and started using the gulp-htmlmin
plugin
My gulp task...
gulp.task('build-html',function(){
return gulp.src(appDev+'test.html')
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest(appProd));
});
fails when applied to this valid HTML, or any document with the <
character:
<div> < back </div>
The error is:
Error: Parse Error: < back </div>
at new HTMLParser (html-minifier\src\htmlparser.js:236:13)
I can think of two solutions:
Replace
<
with<
in all my templates. Doing so manually won't be fun, but that's life. Any idea how to do it in a gulp task?Ditch this plugin in search for one that can parse and minify my templates. Any suggestions?
Guess I'm wondering how someone more experienced at building for deployment (I'm new) would handle this.