Allows for dynamic module extension
npm install gulp-angular-module#gulp-angular-module
>Dymaic angular module extension
##Usage
Install gulp-angular-module as a development dependency:
``shell`
npm install gulp-angular-module --save-dev
Then add it to your gulpfile.js:
`javascript`
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
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:
StringIf set will add all modules found as a dependency to this module.
####masterVendorModules
Type:
ArrayPossible 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.jsYou have the following code
`javascript
angular.module('admin',['fooVendorModule'])
.controller('userManagement', function(fooService){
...
});
`And in
src/modules/admin/userService.jsYou have
`javascript
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.
`javascript
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.