HTML minification breaks Angular 2
Angular 2 does not seem to like:
ngFor vs ngfor
routerLink vs routerlink
<blockquote cite="http://www.google.be">...</blockquote> vs <blockquote cite=http://www.google.be>...</blockquote>
These are modifications that https://www.npmjs.com/package/gulp-minify-html does by default via https://github.com/Swaagie/minimize. The behavior with quotes can be changed but not that with case sensitivity
This is known: https://github.com/angular/angular/issues/5789
Apparently the solution proposed by the Angular team will be an offline template compiler, meaning that we'll have to branch depending on whether the client project uses Angular or not
Issue to keep an eye on: https://github.com/Swaagie/minimize/issues/74
For now, a workaround is to use the new option to disable HTML minification.
gulpfile.babel.js:
options.minifyProductionHTML = false; // HTML minification is not supported by Angular 2 anymore: https://github.com/dsebastien/modernWebDevBuild/issues/67
I had same problem with minify Angular2. It seem has been fix when bump minimize version from 1.7.4 to 1.7.5 (now is 1.8.1?) and added the "dom" option.
dom: {
lowerCaseAttributeNames: false
}
Thanks for the tip @yizhan I'll try this out!