Requirejs setup

So i've done some more work and testing on this and it seems pretty solid so should be fine to pull

This now includes everything needed to build a minified/optimised version using the r.js optimiser as well.

Includes source maps to make debugging in the browser easier.