htmlmin
htmlmin copied to clipboard
doesn't work with angular2, [] and () html syntax
@robertbaker can you give some example code?
Hi there.
I saw this issue is still unresolved and I face the same issue. My error output is following:
Process terminated with code 8.
events.js:72
throw er; // Unhandled 'error' event
^
Error: Parse Error: <li *ngFor="#stroke of service.strokes; #istroke = index" [class.animated]="istroke == service.strokes.length - 1" [class.fade-in]="istroke == service.strokes.length - 1">
<a href="#">
<span>{{stroke}}</span>
</a>
</li>
</ul>
</div>
The HTML-File where the error is thrown looks like this:
<div id="breadcrumbs">
<ul class="list-inline">
<li *ngFor="#stroke of service.strokes; #istroke = index" [class.animated]="istroke == service.strokes.length - 1" [class.fade-in]="istroke == service.strokes.length - 1">
<a href="#">
<span>{{stroke}}</span>
</a>
</li>
</ul>
</div>
My gulpfile pretty much looks like this:
var __gulp = require("gulp");
var __minifyHtml = require("gulp-htmlmin");
[...]
var htmlOptions = {
caseSensitive: true,
removeComments: true
};
__gulp
.src(source)
.pipe(__minifyHtml(htmlOptions))
.pipe(__gulp.dest(dest));
That's all information which I could provide. Do you have any idea what I`m doing wrong?
But [] () and {{}} are not HTML syntax. These are Angular2 Templating system. IMHO, htmlmin should be used after transpiling them to HTML. The problem is: Angular2 doesn't transpile them to HTML, they put inside the JS file to get the SPA effect. So, htmlmin is not the right tool, neither it doesn't do any effect.