We need to build dojo/rforms for performance reasons.
Dojo has a modular approach to code. It loads whatever modules are needed when they are needed (based on "require" function). This means that each module/class is loaded separately, thus worsening performance.
Documentation on custom builds is here.
The goal of a custom build is:
- to combine classes in layers - these are classes that are used on same page(s). For example, if a page uses classes Form and Button, normally the files Form.js and Button.js will be downloaded one by one. We can instead create a layer called "ui-components" that will combine code of two classes so that it could be retrieved with a single http request.
- to optimize code using shrinksafe.
This is how we build dojo and rforms:
- Download dojo 1.6.1 src from http://download.dojotoolkit.org/release-1.6.1/dojo-release-1.6.1-src.tar.gz and unzip in some folder - lets say dojo-src. Following folders will be inside: dojo, dijit, dojox, util.
- Copy rforms and rdfjson folders in dojo-src as well.
- Create file p.js and copy following inside:
Change if needed.
- Go to dojo-src/util/buildscripts and execute
This will create dojo-build-1.6.1 folder and will place dojo and rforms "compiled" files there.
- Find dojo-build-1.6.1\dojo\dojo1.js and dojo-build-1.6.1\dojo\nls\dojo1_en-us.js and copy them to rforms's project (eg trunk\research-space-rforms\src\main\resources\rforms\lib\dojo\dojo and nls folders).
- Include dojo1.js in your html page
Errors that were encountered:
http://dojo-toolkit.33424.n3.nabble.com/Error-running-the-build-script-td3211076.html
Labels:
None