@angularclass/conventions-loader

Allow default for @Component metadata for Angular 2

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@angularclass/conventions-loader
1531.0.136 years ago7 years agoMinified + gzip package size for @angularclass/conventions-loader in KB

Readme

<img width="438" alt="Angular 2 Fundamentals" src="https://cloud.githubusercontent.com/assets/1016365/17200649/085798c6-543c-11e6-8ad0-2484f0641624.png">


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



AngularClass

AngularClass

Learn AngularJS, Angular 2, and Modern Web Development from the best. Looking for corporate Angular training, want to host us, or Angular consulting? patrick@angularclass.com


Apache-2.0