kangax/fabric.js — pull request #821 by drewlustro (2013-09-02 21:18:34+00:00)
Title: Feature requirejs support

### Amendments

Fixes due to @kangax's feedback on [pull request 808](https://github.com/kangax/fabric.js/pull/808)

- Restored `dist/all.js`, `dist/all.min.js`, and `dist/all.min.js.gz` to
**master** branch versions.
- Removed "var window;" from `test.js`
- Revised `build.sh` to always create `dist/all.requirejs.js` AMD module.
requirejs build flag additionally makes the `dist/all.*` files requirejs
compatible.

#### Some Help Please

For some reason git wants to commit these as new versions... I restored them via `$ git checkout master dist/all.js` for all affected files to no avail. git still considers them "new" and wants to commit them. Some help with this please?

---

### Original Pull Request

**requirejs support**
As a demo, `build.sh` will always build dist/all.requirejs.js
Tests only mildly fail (5 total) on text rendering a couple pixels off.
I suspect it's because I'm running the tests on OS X and my
libs are just slightly different than yours. I cannot seem
to convince the test suite environment / scoping to play nicely with the
requirejs version, though.

References of "AMD" in `build.sh` just try to make the code
intend that more libraries will be supported.

**demo requirejs compatible version**
```bash
fabric.js/dist/all.requirejs.js
```

**make all*.js requirejs compatible**
```bash
$ node build modules=ALL requirejs
```

---

Test results from normal build:
```bash
$ node build modules=ALL exclude=json,cufon,gestures
$ node test
```

![screen shot 2013-08-26 at 9 33 40 am](https://f.cloud.github.com/assets/194885/1025963/4d6f22a2-0e54-11e3-9a4b-283702fd79e5.png)