-
Notifications
You must be signed in to change notification settings - Fork 40
Module Loaders
crccheck edited this page Dec 30, 2014
·
3 revisions
Example Usage (browserify & superagent) courtesy of konsumer:
var Raphael = require('raphael');
require('raphael-svg-import-classic');
var ajax = require('superagent');
ajax.get('assets/levels/level1.svg').end(function(err,res){
var paper = Raphael(10, 10, 800, 600);
var newSet = paper.importSVG(res.xhr.responseXML);
});
AMD/RequireJS - http://requirejs.org/
This is what worked for me using version 0.1.1, but it is terrible.
Requires eve
:
- github: adobe-webplatform/eve
- npm: eve
- bower: eve
require.config({
paths: {
'eve': 'eve/0.2.4/eve',
'raphael': 'raphael/2.1.2/raphael',
'raphael-svg-import-classic': 'raphael-svg-import-classic/0.1.1/raphael-svg-import',
},
shim: {
'eve': {
exports: 'eve'
},
'raphael': {
deps: ['eve'],
exports: 'Raphael'
}
}
});
// Beginning Raphael.js AMD shim
require(['raphael'], function (Raphael) {
require(['raphael-svg-import-classic'], function () {