Create-ng-component
use
run yarn create ng-component <component-name>
or
npm i -g create-ng-component
create-ng-component <component-name>
component name should be snake cased.
Work flow
- get component name (as snake case)
- create component-name folder
- inside the folder
- create index.js
- create component-name.js
- create component-name.tmpl.html
Templates
index.js
import componentName from './component-name';
export default componentName;
component-name.js
import templateUrl from './component-name';
const name = 'componentName"
export default {
templateUrl,
name,
bindings: {},
controller: Ctrl
}
function Ctrl() {}
component-name.tmpl.html
<div class="component-name"></div>
Using
- commander: for controlling command line arguments.
- mustache: for compiling the templates.