Rebuilding Dojo

When you customize your store to use new Dojo widgets that a WebSphere Commerce starter store (for example, Aurora) does not use, or if you remove the use of some Dojo widgets for your store, modify the Dojo build profile and rebuild the Dojo files for optimal client-side performance of your site.

The Dojo files that are deployed with the Aurora starter store are built by using the Dojo Build System. Usually with Dojo, depending on the modules that were used, there are many JavaScript files loaded with the web page. Loading many JavaScript files can have a negative performance impact on bandwidth and load time for your storefront pages. The Dojo Build System combines all the JavaScript files that your application uses into small sets of files to reduce load time and bandwidth.

The Dojo build profile for Aurora starter store can be found in WC_installdir/components/samples/Aurora/dojoprofile/Aurora.profile.js. It is the input to the Dojo Build System. The profile describes the dependencies for each JavaScript that is listed in the dependencies attribute and uses layers to separate Dojo modules into different JavaScript files. For example, a profile might resemble the following code:

dependencies = {
  layers:  [
  {
    name: "dojo.js",
    dependencies: [ // common for all desktop, tablet and mobile store
      "dojo.parser",
      "wc.render.Context",
      "wc.render.RefreshController",
      "wc.service.common",
      "wc.widget.RefreshArea"
    ]
  },
  {
    name: "dojodesktop.js",
    layerDependencies: ["dojo.js"],
    dependencies: [ // desktop store specific
      "dijit._base",
      "dijit._base.place",
      "dijit._base.popup",
      "dijit._base.scroll",
    ]
  },
  {
    name: "dojotablet.js",
    layerDependencies: ["dojo.js"],
    dependencies: [ // tablet store specific
      "dijit._base",
      "dojo.cookie",
      "dojox.mobile",
      "dojox.mobile.compat",
    ]
  },
  {
    name: "dojomobile.js",
    layerDependencies: ["dojo.js"],
    dependencies: [ // mobile store specific
      "dijit._base.manager",
      "dojox.mobile",
      "dojox.mobile.compat",
    ]
  }
  ],
  prefixes: [
    [ "dijit", "../dijit" ],
    [ "dojox", "../dojox" ],
    [ "wc", "../wc" ]
  ]
}
The Dojo Build System outputs the following files that are based on the build profile:
dojo.js
Contains the base Dojo modules that are used across all stores for different platforms (mobile, tablet, and desktop).
dojodesktop.js
Contains Dojo modules that are specific for the web store.
dojomobile.js
Contains Dojo modules that are specific for the mobile store.
dojotablet.js
Contains Dojo modules that are specific for the tablet store.

Before you begin

Ensure that you completed the following tasks:
  • Add your custom widgets, or remove unnecessary Dojo widgets files for your store, and modify the Dojo build profile WC_installdir/components/samples/Aurora/dojoprofile/Aurora.profile.js to prepare to rebuild.
Windows

Procedure

  1. Rebuild Dojo:
    1. Go to WC_eardir/Stores.war/
    2. Back up the dojo18 directory: Create a copy of the dojo18 directory and rename it.
      For example, you can rename the copied directory to dojo18_temp.
    3. Download the Source version of Dojo 1.8.
    4. Open the compressed file that you downloaded and copy the util directory to dojo18_temp.
      The resulting directory is WC_eardir/Stores.war/dojo18_temp/util.
    5. Go to WC_installdir/components/samples/Aurora/dojoprofile/
    6. Copy the Aurora.profile.js file to the WC_eardir/Stores.war/dojo18_temp/util/buildscripts/profile directory.
    7. Open a command prompt.
    8. Go to WC_eardir/Stores.war/dojo18_temp/util/buildscripts and run the following command:

      build -p Aurora --release

      The build runs and a release directory is created in the dojo18_temp directory. Ensure that there are no errors in the results. Review warning messages for any possible issues.

  2. Copy the content from WC_eardir/Stores.war/dojo18_temp/release/dojo/ into WC_eardir/Stores.war/dojo18 so that the directory structure matches the original.
  3. Test your changes by going to a page on the storefront.
    • Ensure that the number of JavaScript files that are loaded is expected.
      Note: Some Dojo modules cannot be built into the dojo.js file, like the acme.js and nls files.
    • Ensure that all functions work as expected.