views:

1275

answers:

3

I've been reading O'Reilly book "Dojo - The Definitive Guid" but somethings are still not definitive to me.

They talk about "bootstrapping" and getting the dojo.css from the AOL CDN".

When I'm testing on my machine, should I use the CDN? Or should I wait and use that only when I deploy?

Secondly, the book talks about CDN for dojo, but not for dijit.

I'm developing on Google App Engine (GAE) - so having the 2000+ Dojo/Dijit files in my Javascript directory is a little annoying, because it slows down my upload to GAE each time.

Firebug is giving me this error: GET htt p://localhost:8080/dijit/nls/dijit-all_en-us.js 404 not Found GET htt p://localhost:8080/dijit/_editor/plugins/FontChoice.js 404 not Found

I downloaded the sample from here: http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/themes/themeTester.html?theme=soria and I'd like to "simply" get it to run on my machine under local google app engine (which is the localhost:8080 that you see in the URLs above).

I see this statement which probably is causing the second 404 above: dojo.require("dijit._editor.plugins.FontChoice");

One other error: cannot access optimized closure preload("en-us") dijit-all.js (line 479) anonymous("dijit.nls.dijit-all", ["ROOT", "ar", "ca", 40 more... 0=ROOT 1=ar 2=ca 3=cs 4=da 5=de 6=de-de 7=el 8=en 9=en-gb])dijit-all.js (line 489) dijit-all.js() dojo.i18n._searchLocalePath(locale, true, function(loc){\n

To continue for now, I'm going to try to copy the entire dijit library, but is there a solution short of that?

My current script includes look like this:

<script type="text/javascript" src="/javascript/dijit.js"></script>

<script type="text/javascript" src="/javascript/dijit-all.js" charset="utf-8"></script>

I got the dijit.js file by copying and renaming dijit.js.uncompressed.js to dijit.js.

Thanks in advance! Neal

A: 

To address your first question, use the full source version locally for development, so that you can get clearer debug info which points to a legible line in source, rather than the single line the minified version is reduced to. Use the CDN for production.

Wahnfrieden
+5  A: 

You have a few options actually:

  1. You could use the CDN for everything (though using the full source locally does give you better error messages). Google has them as well. Dijit is here: http://ajax.googleapis.com/ajax/libs/dojo/1.3.2/dijit/dijit.js FYI. This has many advantages in my opinion. User caching of the JS being the primary one.

  2. Build a layered file. I think the O'Reilly book has a section about it but the PragProg book is better in this regard IMO. There's also this doc on dojocampus.org about building. This will trim down the files you need to upload to GAE and speed up your app loading. This is actually what I do in order to cut down on HTTP requests.

  3. Keep doing what you are doing. :)

Regarding the errors you are seeing about 404 for en-us files are essentially harmless. Here's a better description.

You also might be reloading dijit files by using dijit.uncompressed.js and dijit-all.js and causing problems in the process...but I'm not sure about this one.

seth
+1  A: 
Eugene Lazutkin