npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-ng-autobootstrap-private

v1.0.2

Published

A gulp plugin to automatically create bootstrap files for requiring your angular modules with browserify.

Downloads

1

Readme

gulp-ng-autobootstrap

Travis Build

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 = require('gulp-ng-autobootstrap');

gulp.task('ng-autobootstrap', function() {
	return gulp
		.src('js/**/*.js')
		.pipe(ngAutoBootstrap(options))
		.pipe(gulp.dest('js'));
});

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.module('myApp', []);
require('./bootstrap.js')(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.exports = function(app) {
	// Controllers
	app.controller('AppController', require('./controllers/app-controller'));
	app.controller('UsersController', require('./controllers/users-controller'));
	app.controller('PostsController', require('./controllers/posts-controller'));
	app.controller('LoginController', require('./controllers/login-controller'));
	app.controller('SignupController', require('./controllers/signup-controller'));
	app.controller('AccountController', require('./controllers/account-controller'));
	// Directives
	app.directive('autosize', require('./directives/autosize'));
	app.directive('blurOn', require('./directives/blur-on'));
	app.directive('doubleclickToEdit', require('./directives/doubleclick-to-edit'));
	app.directive('parseMarkdown', require('./directives/parse-markdown'));
	// Services
	app.service('ApiService', require('./services/api-service'));
	app.service('AuthService', require('./services/auth-service'));
	app.service('UserService', require('./services/user-service'));
	app.service('PostService', require('./services/post-service'));
};

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, just App or anything you like)
  • Organize your modules how you like

Use cases

Generating one bootstrap.js file per angular module

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 = require('merge-stream');

gulp.task('ng-autobootstrap', function() {
	var admin = gulp
		.src('app/admin/**/*.js')
		.pipe(ngAutobootstrap())
		.pipe(gulp.dest('app/admin'));

	var user = gulp
		.src('app/user/**/*.js')
		.pipe(ngAutobootstrap())
		.pipe(gulp.dest('app/user'));

	return merge(admin, user);
});

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