# gulp-ng-register

> Require and register controllers, directives and services as a gulp task.

Latest version **0.0.5** (published 2015-08-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-ng-register
pnpm add gulp-ng-register
yarn add gulp-ng-register
bun add gulp-ng-register
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2015-08-24 |
| First published | 2015-08-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.11.16 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | marc1404 |
| Maintainers | marc1404 |
| Keywords | gulp, angular, ng, register, require, bootstrap, angularjs |

## Links

- npm: https://www.npmjs.com/package/gulp-ng-register
- Repository: https://github.com/marc1404/gulp-ng-require
- Homepage: https://github.com/marc1404/gulp-ng-require#readme
- Issues: https://github.com/marc1404/gulp-ng-require/issues
- npm.io page: https://npm.io/package/gulp-ng-register

## Dependencies (2)

- [through2](https://npm.io/package/through2.md) ^2.0.0
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.6

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 0.0.5 (latest) — 2015-08-24
- 0.0.4 — 2015-08-18
- 0.0.2 — 2015-08-17
- 0.0.1 — 2015-08-17

## README

# gulp-ng-register
[![npm](https://img.shields.io/npm/v/gulp-ng-register.svg?style=flat-square)](https://www.npmjs.com/package/gulp-ng-register)
[![Travis](https://img.shields.io/travis/marc1404/gulp-ng-register.svg?style=flat-square)](https://travis-ci.org/marc1404/gulp-ng-register)
[![Code Climate](https://img.shields.io/codeclimate/github/marc1404/gulp-ng-register.svg?style=flat-square)](https://codeclimate.com/github/marc1404/gulp-ng-register)
[![Code Climate](https://img.shields.io/codeclimate/coverage/github/marc1404/gulp-ng-register.svg?style=flat-square)](https://codeclimate.com/github/marc1404/gulp-ng-register/coverage)
[![npm](https://img.shields.io/npm/l/gulp-ng-register.svg?style=flat-square)](https://github.com/marc1404/gulp-ng-register/blob/master/LICENSE)
[![npm](https://img.shields.io/npm/dm/gulp-ng-register.svg?style=flat-square)](https://www.npmjs.com/package/gulp-ng-register)

[![David](https://img.shields.io/david/marc1404/gulp-ng-register.svg?style=flat-square)](https://github.com/marc1404/gulp-ng-register/blob/master/package.json)
[![David](https://img.shields.io/david/dev/marc1404/gulp-ng-register.svg?style=flat-square)](https://github.com/marc1404/gulp-ng-register/blob/master/package.json)

## Installation
```
$ npm install gulp-ng-register
```
  
## Description
This [gulp](https://www.npmjs.com/package/gulp) plugin can be used to automatically require and register Angular controller, directive and service modules.  
All files provided by ```gulp.src()``` will be required and registered in your Angular app.  
Modules are required to export a ```name``` property and one of the following:  
- ```controller```
- ```directive```
- ```service```

It will generate a ```register.js``` file at the provided location by ```gulp.dest()```.  
Require this file from your Angular app:  
```javascript
var app = angular.module('MyApp', []);

require('./register')(app);
```

## Usage
```javascript
var gulp = require('gulp');
var ngRegister = require('gulp-ng-register');

gulp.task('register', function(){
  return gulp.src('app/client/**/*.{controller,directive,service}.js')
    .pipe(ngRegister())
    .pipe(gulp.dest('/app/client'));
});
```
  
## Options
You can pass a file name to ```ngRegister()``` if you want.

## Examples
**Controller**
```javascript
exports.name = 'MyController';
exports.controller = /*@ngInject*/ function MyController($scope, $http){
	// TODO: implement your controller
};
```
  
**Directive**
```javascript
exports.name = 'myDirective';
exports.directive = /*@ngInject*/ function inject(){
	return {
		restrict: 'E',
	    scope: {
	      info: '=info'
	    },
	    templateUrl: 'my-template.html'
	};
};
```
  
**Service**
```javascript
exports.name = 'myService';
exports.service = /*@ngInject*/ function inject(){
	return function add(x, y){
		return x + y;
	};
};
```

## Test
```
$ npm install -g mocha  
$ mocha
```
  
## Author
[marc1404](https://github.com/marc1404)

## License
[MIT](https://github.com/marc1404/gulp-ng-register/blob/master/LICENSE)

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