A webpack loader which minify html template strings in your angular2 component code.
INPUT:
@Component({
selector: "my-component",
template: `
<div>
Hello, world
</div>
`
})
export class MyComponent {
//
}
OUTPUT:
@Component({
selector: "my-component",
template: `<div>Hello, world</div>`
})
export class MyComponent {
//
}
You can pass html-minifier options to this loader by writing them as a query string:
module: {
loaders: [
{
test: /\.component\.ts$/,
exclude: /node_modules/,
loader: "ts!angular2-html-template?collapseWhitespace=true"
}
]
}
To preserve camel-cased attribute names(e.g. *ngIf
), this loader turn the caseSensitive
option true
by the default.
This software is released under the MIT License, see LICENSE.txt.