We use dojo 1.7.2 in our application. Although AMD supported in this version, we do not use this approach at all. We are still with the deprecated dojo.require("package") approach.
We need to create a release build for our application. Below is the profile we use for this. For this we use the ANT task. Our profile is very simple and does not have a lot of dojo in it.
dependencies = { layers: [ { name:"cutom_dojo.js", resourceName:"custom-dojo", dependencies:[ "dojo.NodeList-traverse", "dojo.io.iframe", "dojo.date", ] } ], prefixes: [ [ "dijit", "../dijit" ], [ "dojox", "../dojox" ] ] }
Now we are creating the release build using the following ANT task.
<target name="create-dojo-release"> <echo message="Starting Dojo Release Build " /> <java fork="true" dir="${shrinksafe.util.path}/buildscripts" classname="org.mozilla.javascript.tools.shell.Main"> <classpath> <pathelement location="${shrinksafe.util.path}/shrinksafe/js.jar" /> <pathelement location="${shrinksafe.util.path}/closureCompiler/compiler.jar"/> <pathelement location="${shrinksafe.util.path}/shrinksafe/shrinksafe.jar" /> <pathelement path="${java.class.path}" /> </classpath> <arg value="../../dojo/dojo.js"/> <arg value="baseUrl=../../dojo"/> <arg value="releaseDir=${dojo.release.dir}"/> <arg value="load=build"/> <arg value="profile=${dojo.profile.file}" /> <arg value="action=clean,release" /> <arg value="version=1.7.2" /> <arg value="releaseName=cutom_dojo" /> <arg value="cssOptimize=comments" /> <arg value="copyTests=false" /> </java> <echo message="Dojo Release build successfull." /> </target>
We get the custom_dojo.js file in the dojo folder. We have included this JS file in our application. When we open this JS file and look for packages that are mentioned in the layer, they are all available there. But when we turn to the application page, we still see that individual HTTP requests are sent for individual modules, although the custom_dojo.js file is located at the top of the page. Could you suggest us if we do it right?
source share