jrburke/r.js — pull request #490 by Naddiseo (2013-07-23 07:34:56+00:00)
Title: Demo implementation to fetch files from CDNs

I've seen this feature requested a few times around the web, and I needed it myself, so this is a partial implementation for allowing r.js to fetch files from a CDN to include in the compressed file. I'm assuming that since I only implemented it in node/file.js it'll only work on node.

Some feedback would be useful, I think one thing that would help is to add something to the optimized file that removes the entries in the paths config for cdns.

To anyone that finds this patch useful, my requirejs.config is similar to:
```javascript
requirejs.config({
baseUrl :'/static/js/lib',
paths : {
main : '../app/main',
jquery : '//cdnjs.... url/jquery'
},
deps : ['main']
})
```

And my r.js build config:
```javascript
({
optimize: "none",
baseUrl : "project/static/js/lib",
out : "project/static/js/app/main-compressed.js",
name : "main",
mainConfigFile : "project/static/js/requireconfig.js",
paths : {
main : "../app/main"
},
fetchFromNetwork : true,
wrap: {
start: "(function() {",
end: "\nrequire(['main']);}());"
},
})
```