tags:

views:

199

answers:

2

I use quite a lot of Dojo, but to date I've only used if by including from a CDN such as AOL/Google.

Are there advantages to hosting a copy of Dojo rather than using it via a CDN? I don't have much need to alter the code base, but I imagine there are other advantages/disadvantages?

+3  A: 

Hey Peter,

by hosting your own Dojo env. you are for example able to make a custom build of dojo. So you only need to load one *.js file. That saves traffic used by the xhr requests.

-jstr

Yes, custom builds should be the primary reason to host it yourself.
Horst Gutmann
Not quite the power of a custom build, but there are a few 'standard' layers included on the CDN, like dijit.js, which will come down in one piece with a dojo.require('dijit.dijit')
peller
That's interesting. Would the use of a custom build mean changing the 'dojo.require's that I use currently?
Peter
jep,by creating a custom buid and including it you don't need any dojo.requires anymore, because all required resources are included in the file which get loaded by the <script ... /> tag.
A: 

Disadvantage to hosting anything externally is that you don't have control over it. You won't get this with the Google/AOL CDN but you could land up with the same issue that BootyCall got when using Doug Crockfords json.js from his site. http://ajaxian.com/archives/doug-crockford-and-the-online-booty-call-saga

Advantange is that you don't have to pay for bandwidth and will have the correct expiries added to it all the time

AutomatedTester
Thanks - really useful example.Is setting the expiry on the build something that requires much work?
Peter
no, its normally just updating your webserver with the relevant data e.g. on apache installing mod_expires http://httpd.apache.org/docs/2.0/mod/mod_expires.html
AutomatedTester