Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/evanshortiss/angularify
Load angular dependencies in a browserify friendly manner with simple version selection.
https://github.com/evanshortiss/angularify
Last synced: 21 days ago
JSON representation
Load angular dependencies in a browserify friendly manner with simple version selection.
- Host: GitHub
- URL: https://github.com/evanshortiss/angularify
- Owner: evanshortiss
- License: mit
- Created: 2014-06-06T13:51:16.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-18T18:56:07.000Z (over 10 years ago)
- Last Synced: 2024-04-09T13:09:26.440Z (7 months ago)
- Language: JavaScript
- Size: 185 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
angular-browserify
==================Browserify transform to load angular dependencies in a browserify friendly
manner with simple version selection via the _require_ statement.I wanted to do this as Angular doesn't support UMD so *require-ing* it isn't
really possible. What this module actually does is detects calls to require
Angular in your entry point script and then includes angular before your
browserified entry point runs.## Challenges
Currently this module works almost as intended. It will download and inject
Angular but it injects it within a closure (browserify's closure) so it is
therefore not global making angular inaccessable from other modules. A
workaround is provided in a below example.## Usage in Code
In your application entry file simply use the standard _require_ statement to
have a speecific version of Angular or a code Angular module loaded. You only
need to do this once as Angular is then made global and modules will be bound
in the usual Angular manner!An example Browserify entry point file is below.
```javascript
/**
* file: main.js
*/var angular = require('./angularProvider.js');
angular.module('MyApp', ['ngRoute']);
``````javascript
/**
* file: angularProvider.js
*/// Angular is now included in your browserify build (bundle.js)
require('[email protected]');
// ngRoute is now included in your build too!
require('[email protected]');module.exports = angular;
```## TODO
Tests. I have just made this repository public and gotten the transform
behaving, but now it needs to be tested to verify it works the way one expects
it to when browserified.