Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-angular-module

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-angular-module

Allows for dynamic module extension

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

#gulp-angular-module

Dymaic angular module extension

##Usage

Install gulp-angular-module as a development dependency:

npm install gulp-angular-module --save-dev

Then add it to your gulpfile.js:

var angularModule = require('gulp-angular-module'),
    gulp = require('gulp');
    
    gulp.task('module', function(){
        gulp.sr('./src/app/*.js')
            .pipe(angularModule())
            .pipe(gulp.dest('./dist/'));
    });

API

Options

####moduleDefinitionFileName Type: String

If defined then all module definitions will be placed here. The default behaviour will place a module definition in a file named the same as the module.

####masterModule Type: String

If set will add all modules found as a dependency to this module.

####masterVendorModules Type: Array

Possible 3rd party vendor modules to add to the master module.

Use cases

Let's say you have a very large angular app that you've separated into different modules

|
+- src
|   +- modules
|       +- admin
|           +- userManagmentController.js
|           +- userService.js
|       +- ui
|           +- specialButtonDirective.js
|           +- awesomeSliderDirective.js
+- dist

In the src/modules/admin/userManagmentController.js

You have the following code

angular.module('admin',['fooVendorModule'])
.controller('userManagement', function(fooService){
    ...
});

And in src/modules/admin/userService.js

You have

angular.module('admin',['barVendorModule'])
.service('userService', function(barService){
    ...
});

There would be an issue because angular only allows a module to be defined once. To fix this you then have to create an app.js at root of the module and redefine all the dependencies there, whilst also having to replace all of the module definitions up in all your controllers, constants, directives, ect.

angular.module('admin',['barVendorModule','fooVendorModule']);

As you can guess this becomes a very large cognitive load as your app gets very large and this plugin automates this process.

Keywords

FAQs

Package last updated on 26 Jul 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc