Create optimized Dojo builds for your custom Dojo
Skill Level: Intermediate
Manjunath Ganga (email@example.com)
10 Nov 2009
Create a custom Dojo build for your custom widgets without including any modules
from the dojo/dojox/dijit packages into your build output. Custom Dojo builds reduce
the number of modules to be downloaded by combining all the modules into a single
file, thereby reducing the number of network calls required for the individual module
files. These techniques were developed with a real-world project where compact
packages were a requirement. This article helps you to create optimized Dojo builds
using the Dojo build tool.
Dojo contains thousands of files in its source distribution, organized into packages.
You can also create your own custom modules, preferably in a separate package
away from the Dojo source tree. Each dojo.require() statement results in a
synchronous HTTP call to the server for the requested module. Because browsers
wait for each synchronous call to complete before continuing with anything else, this
will significantly impact performance, especially so with larger applications that have
many module dependencies. Also, the modules in their original form will require
more time and bandwidth to download.
Custom Dojo builds help to improve performance by performing the following tasks:
• Grouping individual modules into layers. A layer, which is one large .js
file, loads faster than the individual .js modules that comprise it.
Create optimized Dojo builds for your custom Dojo artifacts
© Copyright IBM Corporation 2009. All rights reserved.
Page 1 of 10
Dijit templates, it pulls the entire HTML template file and assigns it to a
• Compressing the layer with the tool Shrinksafe. Because layer files can
be large, this compression can reduce the file size substantially, which
can result in a faster load time. And, as the file size is reduced, it takes