0.1.0 • Published 8 years ago
gulp-ng-modules v0.1.0
Gulp Angular Module injection
Angular.js module dependency injection.
How it works?
It inject into a main module file that requires all your modules as a dependency.
Supports
- Adding a new module
- Removing a module
- 3rd party modules
Data entry:
- example-1.js
angular.module('myGlobalApp', []);
example-2.js
(function() { 'use strict'; angular.module('myGlobalApp', ['myModule']) })()
example-3.js
(function() { 'use strict'; angular.module('myGlobalApp', [ 'myModule' ]) })()
- example-1.js
How to install
npm install gulp-ng-modules --save-dev
Usage
var gulp = require('gulp');
var ngModules = require('gulp-ng-modules');
gulp.task('inject:modules', function() {
return gulp.src(['./app.js'])
.pipe(ngModules({name: 'myGlobalApp'}))
.pipe(gulp.dest('./dist'))
})
API
ngModules(options)
Options:
name
Type: string
required
The name of the module to create.
modules
Type: array
optional
List of additional modules to include.
filter
Type: array
optional
List of additional modules to exclude.
transform
Type: function
optional
Create a custom output file
Example
Check out the example directory: gulpfile.js
This is how the generated gulp-ng-modules.js will look like after
(function () {
'use strict';
angular.module('myGlobalApp', ['another.module', 'ui.router']);
})();