wycats/handlebars.js — pull request #537 by spikebrehm (2013-05-27 18:27:14+00:00)
Title: Support AMD and CommonJS out of the box

This add support for both AMD and CommonJS, falling back to typical browser behavior. This is very similar to https://github.com/wycats/handlebars.js/pull/501, but a bit cleaner. This also obviates https://github.com/wycats/handlebars.js/pull/500 and https://github.com/wycats/handlebars.js/pull/509.

It would be awesome to support these module loaders out of the box, preventing developers from using forks to support their projects (as I have had to do). Browserify does enable the use of Handlebars + CommonJS in the client side, but only with a fancy AST-walk in a build step; it makes sense to allow CommonJS without a fancy build step.

Specs are passing:

```
Finished in 0.24254 seconds
202 examples, 0 failures

> handlebars@1.0.11 test /Users/spike/code/spikebrehm/handlebars.js
> node_modules/.bin/mocha -u qunit spec/qunit_spec.js

․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
․․․․․․․․․․․․․․․․․․․․

134 tests complete (121 ms)
```