1,637 karma · joined February 20, 2007
1. lazy-loads files
2. handles JS/CSS/images
3. handles nested dependencies
4. makes it easy to manage dependencies among team members
5. is extremely lightweight
I realize that many teams use RequireJS to manage dependencies but I saw an opportunity to make a library that could accomplish many of the same things but with a much smaller footprint and a simpler API. I hope you'll give it a try and let me know what you think!In MUI we detect all elements present in the DOM when DOMContentLoaded fires using document.querySelectorAll() and then use SentinelJS to detect elements added after.
Initially I was hesitant to add CSS support because handling load errors across browsers is very tricky but I think we came up with a good solution [1] that is tested down to IE9 [2].
[1] https://github.com/muicss/loadjs/blob/master/src/loadjs.js#L...
[2] https://github.com/muicss/loadjs/blob/master/test/tests.js#L...
https://github.com/sun2rise/dysel/blob/master/dist/dysel.js#...
Arrow functions would be great but then we'd have to drop support for browsers that don't support ES6.
* Replaced for-loops with while-loops [1]
* Removed un-necessary code in the script loading function [2][3]
* Removed setTimeout wrapper [4][5]
[1] https://github.com/muicss/loadjs/blob/master/src/loadjs.js#L...[2] https://github.com/muicss/loadjs/blob/master/src/loadjs.js#L...
[3] https://github.com/muicss/loadjs/blob/8d380e1f6c2af431b08088...
[4] https://github.com/muicss/loadjs/blob/master/src/loadjs.js#L...
[5] https://github.com/muicss/loadjs/blob/8d380e1f6c2af431b08088...
RequireJS is a fully-featured dependency manager that works in legacy browsers. It has a payload size of 6.2KB (minified + gzipped).
Let me know what you think!
https://github.com/amorey/mui/blob/master/src/sass/mui/_butt...