Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    gulp-angular-modulepublic

    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.

    install

    npm i gulp-angular-module

    Downloadslast 7 days

    37

    version

    0.0.2

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar