New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

gulp-ng-register

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-ng-register

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

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

gulp-ng-register

npm Travis Code Climate Code Climate npm npm

David David

Installation

$ npm install gulp-ng-register

Description

This 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:

var app = angular.module('MyApp', []);

require('./register')(app);

Usage

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

exports.name = 'MyController';
exports.controller = /*@ngInject*/ function MyController($scope, $http){
	// TODO: implement your controller
};

Directive

exports.name = 'myDirective';
exports.directive = /*@ngInject*/ function inject(){
	return {
		restrict: 'E',
	    scope: {
	      info: '=info'
	    },
	    templateUrl: 'my-template.html'
	};
};

Service

exports.name = 'myService';
exports.service = /*@ngInject*/ function inject(){
	return function add(x, y){
		return x + y;
	};
};

Test

$ npm install -g mocha  
$ mocha

Author

marc1404

License

MIT

Keywords

gulp

FAQs

Package last updated on 24 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts