This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
25
My AngularJS-Specific Script Loader is Nearing v1.0
Post Body
Link: https://github.com/hansl/angularjs-loader
So I was growing really tired of the complexity of RequireJS (and its perks WRT angular) and decided to implement my own script loader which relies on angular.module()
declarations to figure out which script to load next.
A couple of things:
- You can use
angular.loader()
to load scripts that are not AngularJS modules. It also takes a shim or a function to check that the script was loaded properly. - Although the script allows you to use path transformation to have modules like 'a.b.c' map to 'a/b/c.js', I would still suggest naming your modules with the path including slashes (minus the
.js
) if you don't feel like you understand path transformation. I made my best to explain it. - There is a definite lack of examples. My own private projects (under NDA) are the ones I use for complex tests, but I want to come up with cookbook. For now, it's rather easy to figure it out for simple cases anyway.
- The minified version (still working) on my computer is less than 4kb. It's also way faster than RequireJS (at least on my machine compared to before, and I have more modules to load now).
What's new (compared to last time I posted):
- There is now a
concat.js
scripts that reads all the files you declared and output a file with all dependencies solved. This is supposed to be a pre-step to compilation (with closure or uglify). - Styleguide is more rigorously followed.
- Unittests. Not 30% coverage but I do cover major use cases.
- Timing out is now taken into account.
- Bug fixes and ironing out.
- Ability to set an error handler.
Known issues:
- Absolute paths will be loaded correctly in AngularJS but will not be included in
concat.js
output. I want to fix that one.
To do:
- Benchmarks.
- More tests and bug fixes.
- Bump version to 1.
Taking all comments and questions
Author
Account Strength
100%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
5,383
Link Karma
890
Comment Karma
4,493
Profile updated: 2 days ago
Posts updated: 8 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 10 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/angularjs/c...