Making Sense of Dependency with Require.js

Corey Light

January 2014 / Show-Me Tech

AMD

(Asynchronous module definition)

"A JavaScript API for defining modules such that the module and its dependencies can be asynchronously loaded."

Why AMD?

Who's using it?

  • jQuery 1.7
  • Dojo 1.7
  • EmbedJS
  • Firebug
  • Node

The Old

The New

The Magic

Asynchronicity!

Setting it Up

What about non-AMD modules?

Benefits

  • Async
  • Allows for many different, small js files to be used in development
  • Allows for CDN with local fallbacks
  • Consistency and maintainability
  • Use R.js for production to combine and minify all assets

Questions? Thanks!