Running a Dojo custom build
The Dojo build system creates an efficient version of Dojo for application deployment by creating Dojo builds that are customized to a specific web application.
Before you begin
About this task
- The Dojo build system assembles the Dojo resources and external dependencies, such as widget templates, into one or more layers. The contents of the external dependencies change into a string in the layer JavaScript file.
- The Dojo build system compresses the layers using Shrinksafe to remove any extra spaces, extra lines, comments, duplicate resources, and to shorten internal variable names.
- The Dojo build system copies all non-layered JavaScript to an easily accessible location, ensuring that all Dojo resources can be loaded even if they are not contained by a layer.
The Dojo library contains many files and resources that can be called by the web page. When you use the dojo.require statement, the web page makes a synchronous HTTP call to the server to retrieve a resource. The dojo.require statement prevents the web page from having to load a resource that has been loaded prior; however, by using the dojo.require statement, your web page must first load the resource before it can be used. In a web page with multiple dojo.require statements, each call to the server must be completed before it moves to the next call, significantly affecting application performance.
A Dojo layer file reduces the number of asynchronous requests to a single request. A layer is a single JavaScript file that contains and compresses multiple JavaScript files and any dependencies. It can contain an entire library or it can contain all of the widgets that are requested by a particular page. All extra spaces, blank lines, and comments are removed and internal variable names are shortened. using the HTML script tag. The layer files are loaded asynchronously reducing the load time.
For example, you might have a web application with multiple Dojo require statements in each page. By creating a layer file for each page, only one asynchronous request is made per page.
For more information on the Dojo build system, refer to Dojo build system documentation.
To enhance the performance of your Dojo application with the Dojo build system: