27
May

Two alternatives for RequireJS

These days I’ve been looking for alternatives to RequireJS.

The reason is that rJS is a little too complex to be worth integrating with it. Not all JS libraries are AMD compatible and this brings an extra overhead. Besides, the setup time for a new project is not fast enough.

I’ve started my search for alternatives. After looking at a few libs at this link [flash content], I’ve ended up with 2 solutions that that I preffer:

  • yepnope js – used by Modernizr
  • labJS – a performance oriented script loader

Top 3 things I like about yepnope js:

  1. Ability to preload scripts without executing them. For example Gmail for mobile uses this technique for performance reasons. AFAIK RequireJS can’t do that.
  2. Ability to load CSS along with the JS files. AFAIK RequireJS doesn’t handle that. Update: as per Patrick’s comment bellow, there is a hook to achieve that eventually. Thanks Patrick !
  3. Ability to insert a test function before loading a script. I’m quoting Modernizr: “combine feature detection with media queries and conditional resource loading. That gives you the power and flexibility to optimize for every circumstance.”