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.

About this task

The Dojo build system also improves performance:
  • 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.
Learn more about Dojo layers:

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:

Procedure

  1. Click File > New > Other > Web > Dojo Custom Build and then click Next. The Dojo Build Utility wizard opens.
  2. Specify your Profile Locations file that you created in Create a builder profile.
  3. Specify the location of the Dojo library on the Dojo Location field.
  4. Specify the build scripts and output directories, on the Output Location field.
    Tip: The profile, build scripts, and output directories can be in the same project or different projects.
  5. To display only the layer files in the output, check Only output layer files.
  6. Click Override profile settings with command line to specify an Optimization method. You can specify whether to delete output directories before building, copy test files into the build, or intern widget templates. When you intern a template, the HTML or CSS file is brought into the JavaScript file and assigned to a string.
  7. (Optional) Click Next to specify advanced options.
    • To add a command-line argument, click the add icon. Type the argument and value in the New Argument window.
    • To edit an existing command-line argument, click the edit icon.
    • Click the delete icon to remove a command-line argument.
  8. Click Finish. The Custom Build Output window opens and displays details of the build operation. Any error messages appear in red text.
  9. Click OK to close the Custom Build Output window.

Results

The entire Dojo distribution is built and the Dojo layer files that you selected are created in the output folder that you specified in the wizard.

What to do next

Now that you created Dojo layers using the Dojo build system, you can include a Dojo layer file in your web page.
Icon that indicates the type of topic Task topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: tdojobuilders.html