htmlmin icon indicating copy to clipboard operation
htmlmin copied to clipboard

doesn't work with angular2, [] and () html syntax

Open ghost opened this issue 9 years ago • 3 comments

ghost avatar Nov 19 '15 18:11 ghost

@robertbaker can you give some example code?

jserme avatar Dec 11 '15 08:12 jserme

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?

Cotspheer avatar Jan 30 '16 12:01 Cotspheer

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.

anderflash avatar Feb 03 '17 16:02 anderflash