gulp-ng-autobootstrap
Automatically generate bootstrap files for your browserify-powered angular apps that pull in all your angular modules (like controllers and directives) for you.
Inspired by ng-classify.
Usage
1. Install via npm
npm install gulp-ng-autobootstrap
2. Include in your gulp file
var ngAutoBootstrap = ;gulp;
Options
Options are passed to the ng-autobootstrap module behind the scenes. Check out the documentation on options there.
How it works
Consider an angular app with many controllers, directives, services, animations – like this one:
controllers/
app-controller.js
users-controller.js
posts-controller.js
login-controller.js
signup-controller.js
account-controller.js
directives/
autosize.js
blur-on.js
doubleclick-to-edit.js
parse-markdown.js
services/
api-service.js
auth-service.js
user-service.js
post-service.js
main.js
Pull in a single file to hook everything up
main.js
var app = angular;app;
ng-autobootstrap automatically creates the bootstrap-file that include all these angular modules and hooks them up with your app. This could look like this:
bootstrap.js
'use strict';module {// Controllersapp;app;app;app;app;app;// Directivesapp;app;app;app;// Servicesapp;app;app;app;};
Fully Customizable
- Configure path and name for your bootstap file
- Configure any casing convention for your module names (
camelCase
,PascalCase
,Title Case
,snake_case
,lowercase
,UPPERCASE
,CONSTANT_CASE
and more) - Configure prefixes and suffixes for your module names (
AppCtrl
,AppController
, justApp
or anything you like) - Organize your modules how you like
Use cases
bootstrap.js
file per angular module
Generating one If you're splitting up your app into multiple modules, like angular.module('app.admin', [])
and angular.module('app.user', [])
, your directory structure may look something like this:
app/
admin/
controllers/
directives/
user/
controllers/
services/
You can effortlessly create multiple bootstrap.js
files (one for each module) using gulp:
var merge = ;gulp;
Then you will end up with multiple `bootstrap.js files like this:
app/
admin/
controllers/
directives/
bootstrap.js // pulls in admin-controllers and admin-directives
user/
controllers/
services/
bootstrap.js // pulls in user-controllers and user-services