Rails 3.1 edge use sprockets to handle .js and .scss files. Sprockets use comments to deal with dependencies.
Now dojo has been merged into application.js. But dojo has dependency system itself. When I require more dojo modules. It cannot find the right path. dojo.require("dojox.grid.DataGrid"); // Error in webkit console: Error: Could not load 'dojox.grid.DataGrid'; last tried '../dojox/grid/DataGrid.js' // Error in rails server log: Started GET "/undefined../dojox/grid/DataGrid.js" for 127.0.0.1 at Sat Apr 16 01:26:05 +0800 2011
These are two different dependency systems. How can I put them together?
dojo.js doesn't take too naturally to being renamed. This is because part of Dojo's initialization process involves searching through the DOM for the script tag responsible for loading itself. It does this for two reasons:
baseUrlif not already specified
data-dojo-configin 1.6+) properties specified in the script tag itself
When it searches for this script tag, it looks for one with
src set to
dojo.xd.js; it's not finding it in your case, thus the failures.
It should be possible to work around both of these issues, by specifying
dojoConfig in 1.6+) fully programmatically in another
script tag before the one that loads Dojo, and by specifying
baseUrl manually in these config properties.
For example, if your
application.js were in
For more information on dojo config settings: http://dojotoolkit.org/reference-guide/djConfig.html (in fact, that page actually has a note under baseUrl specifically about renamed