kangax/fabric.js — pull request #825 by drewlustro (2013-09-03 18:26:44+00:00)
Title: requirejs support added via "requirejs" build.sh option

### Summary

**To build with requirejs support into dist/all**
`$ node build modules=ALL requirejs`

- requirejs-compatible module built to `dist/all.require.js` always via default build
- requirejs-compatible module built to `dist/all.*` by `requirejs` build flag
- `dist/all*` is clean of commits from this feature branch
- fixed bug in build.sh that would prevent dist/all.require.js from compiling properly
- Updated `test.js` to include `test_script.js` fixtures
- **Note:** Qunit tests largely incompatible with requirejs version... need more
insight on how Qunit works to get fabric in the namespace since it is
no longer a global when built as an AMD module.

---

### Amendments

##### From @kangax's feedback on [pull request 821](https://github.com/kangax/fabric.js/pull/821)

- `dist/all*` is clean of changes
- fixed bug in build.sh that would prevent `dist/all.require.js` from compiling properly

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

Fixes due to

- 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)