It seems that dijit.Menu is dependent on dojo/resources/blank.gif
which is found when we perform a dojo build and leave it in the release
directory. We are building a single layer - our build profile is as follows:
dependencies = {
layers: [{
name: "dojo.js",
dependencies: ["core.bootstrap.dojo_deps"]
}],
prefixes: [
["core", "../../../core"],
["dijit", "../dijit"],
["dojox", "../dojox"]
]
};
Our problem arises when we attempt to rename dojo.js to something else. When we do that, dojo can no longer find the dojo/resources
directory. Here is an example:
<html>
<head>
<script type="text/javascript" src="dojo_release_140_src/release/dojo/dojo/complete-bu开发者_StackOverflow中文版ild.js"></script>
<link rel="stylesheet" type="text/css" href="dojo_release_140_src/dijit/themes/dijit.css" />
<link rel="stylesheet" type="text/css" href="dojo_release_140_src/dijit/themes/tundra/Menu.css" />
<script type="text/javascript">
dojo.require("dijit.Menu");
dojo.ready(function(){
pMenu = new dijit.Menu({
targetNodeIds: ["menu"],
leftClickToOpen: true
});
pMenu.addChild(new dijit.PopupMenuItem({
label: "Clocks"
}));
});
</script>
</head>
<body class="tundra">
<a id="menu">menu</a>
</body>
</html>
As shown, the browser will attempt to fetch undefined./resources/blank.gif
; however, if we change complete-build.js
to dojo.js
it finds it successfully at dojo_release_140_src/release/dojo/dojo/resources/blank.gif
. We can't keep the name as dojo.js - right now we are working around it by actually creating an undefined.
directory at the base of our domain and sticking the image in there.
Help!
I believe the bootstrap looks for the script tag containing 'dojo.js' in order to determine the path for loading resources. If you must rename dojo.js, try defining djConfig.baseUrl prior to the SCRIPT tag which loads your renamed Dojo.
精彩评论