Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export angular-busy as CommonJS-module #92

Open
brunnurs opened this issue Dec 15, 2015 · 2 comments
Open

Export angular-busy as CommonJS-module #92

brunnurs opened this issue Dec 15, 2015 · 2 comments

Comments

@brunnurs
Copy link

It would be great if we could include angular-busy with the CommonJS modularization-syntax. Using your great piece of code, especially in combination with NPM, browserify and AngularJS, would be much simpler.

As an example, have a look at my angular app.js file:

var app = angular.module('myProject', [
    'cgBusy',
    'ngFileSaver',
    'ngmap',
    require('angular-ui-router'),
    require('angular-animate'),
    require('angular-resource'),
    require('angular-ui-bootstrap'),
    require('ng-file-upload'),
    require('angular-smart-table'),
    require('angular-cookies'),
    require('angular-translate'),
    require('angular-dynamic-locale')

Most of my 3rd party dependencies (except of the first three) are referenced with the CommonJS require - keyword. With browserify, all I need to do is to execute browserify app.js > bundle.js and all dependencies (and even more important the transitive dependencies) are loaded from NPM in the specified version and bundled to one file. No need to add the files to my index.html manually or with additional tools like Grunt/Gulp. All we need to do is the standard angular initialization.

AFAIK, it is quite easy to implement it. Add an index.js- file with the following content to your repo (example is the angular-animate dependency):

require('./angular-animate');
module.exports = 'ngAnimate';

It is also an investment into the future, as the module-concept will be an important part of ECMAScript 6.

Let me know if I can help u!

@craigcabrey
Copy link

To add on, we should require the dist version of the library, not the one at the root of the repo (the dist version includes the default template):

require('./dist/angular-busy');
module.exports = 'cgBusy';

@brunnurs
Copy link
Author

apparently the job has already been done by @myflowpl (https://github.com/myflowpl/angular-busy2). I use this fork now, which works perfectly with browserify/webpack.
Many thanks for the work @myflowpl!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants