# ng2g

> A super simple scaffolding tool for Angular 2 components, directives, service and pipes

Latest version **0.0.4** (published 2016-06-12) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install ng2g
pnpm add ng2g
yarn add ng2g
bun add ng2g
```

Provides the command `ng2g`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2016-06-12 |
| First published | 2016-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Rex Ye |
| Maintainers | rexebin |

## Links

- npm: https://www.npmjs.com/package/ng2g
- npm.io page: https://npm.io/package/ng2g

## Dependencies (1)

- [mustache](https://npm.io/package/mustache.md) ^2.2.1

## Recent versions

- 0.0.4 (latest) — 2016-06-12
- 0.0.3 — 2016-06-12
- 0.0.2 — 2016-06-12
- 0.0.1 — 2016-06-12

## README

# Code Generators for Angular 2

This is an ultra-simple cli tool for generating Angular2 component, directive, service and pipe scaffolding, with naming conventions 
taken from the [Angular 2 Style Guide](https://angular.io/styleguide)

This project is an extension of [michaelbromley/cmpg](https://github.com/michaelbromley/cmpg) and is inspired by [angular-cli](https://github.com/angular/angular-cli).

### Templates
Currently the templates for a webpack-based build using Sass for styles. A good enhancement would be to somehow allow different template files to be specified.

Sass-loader configuration for webpack project:
`
      {
        test: /\.scss$/,
        exclude: /node_modules/,
        loader: 'to-string!css-loader!postcss-loader!sass-loader'
      }
      `

### Usage
```bash
npm install -g ng2g
```
#### Component Generator

`> ng2g component component-selector`, use kebab case for the component selector.

#### Service Generator

`> ng2g service ServiceName`, use pascal or camel case for the service name.

#### Pipe Generator

`> ng2g pipe pipeName`, use pascal or camel case for the pipe name.

#### Directive Generator

`> ng2g directive directiveName`, use pascal or camel case for the directive name.

#### Example

That will generate a TypeScript component, test, HTML and Sass file named according to
the argument passed:

`> ng2g component foo-selector`

result:

```
./foo-selector/
  |- foo-selector.component.ts
  |- foo-selector.component.spec.ts
  |- foo-selector.component.html
  |- foo-selector.scss
```

The TypeScript file will look like this:
```TypeScript
import { Component } from '@angular/core';

@Component({
  selector: 'foo-selector',
  template: require('./foo-selector.component.html'),
  styles: [require('./foo-selector.scss')]
})
export class FooSelectorComponent {
}
```

If the templates are not to your liking, just go in `templates/` and
edit away. Make sure to run step 2 again after making any changes.

That's it.

License: MIT

---
_Source: https://npm.io/package/ng2g · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
