@angularclass/conventions-loader
v1.0.13 angular2 webpack angularjs loader angular2-loader angular2-conventions-loader AngularClass AngularClassModules
Angular 2 Conventions Loader
Allow defaults for @Component
metadata for Angular 2
npm install @angularclass/conventions-loader --save-dev
loader options
// default values
selectorPrefix = '';
cssExtension = '.css';
htmlExtension = '.html';
'-component' is removed from selector generated by className
{
test: /\.ts$/,
loaders: [
'ts-loader',
'@angularclass/conventions-loader'
]
},
Given this simple Component example
app.js
@Component({})
export class App {
}
Webpack will change the code
app.js
@Component({
selector: "app",
styles: [require("./app.css")],
template: require("./app.html")
})
export class App {
}
this is assuming you have corresponding files next to the component. You may overwrite the selector at anytime by providing one. If the selector and the component file name does not match then the corresponding css/template file with the selector will be injected.
Credits
Sean Larkin from the Webpack team TheLarkInn/angular2-template-loader
enjoy — AngularClass
Learn AngularJS, Angular 2, and Modern Web Development from the best. Looking for corporate Angular training, want to host us, or Angular consulting? [email protected]
Apache-2.0
npm i @angularclass/conventions-loader
Metadata
- Apache-2.0
- Whatever
- PatrickJS
- released 11/7/2016