Tuesday, October 2, 2012

Creating Dojo 1.7.2 Custom Build


Dojo's build system provides a way to "build" Dojo and your other JavaScript resources and CSS files, so they can be more efficiently used in a production environment by your applications.
Many UI and dojo and UI developers face so many issues during creating the dojo custom build. 

Prerequisites:
You need the following installed on your computer to run Dojo’s build system:
 Java 1.4.2 or later (Java 1.5 recommended).
A source build of Dojo, which you can obtain at http://download.dojotoolkit.org/

Below are the steps to create the dojo 1.7.2 custom build.
1)      Create “dojo-customBuild” folder in <dojo src folder>\util\buildscripts\profiles
2)      Create a new profile name as “myprofile.profile.js” and put this file  under “dojo-customBuild” folder which we have created in step 1.
3)      Profile name is “myprofile.profile.js”. Put below entries in this file.
var profile = {
               
                basePath:"../../..",
               
                releaseDir:"./dojoRelease",

                layerOptimize: "shrinksafe.keepLines",
              
                hasReport: true,

                packages:[
                                {name: "dojo",location: "./dojo"},
                                {name: "dijit",location: "./dijit"},
                                {name: "dojox",location: "./dojox"}       
                ],
               
                layers: {
                                'dojo/dojo': {
                                                include: [ "dojo/dojo", "dojo/main", "dojo/i18n", "dojo/selector/acme", "dojo/fx/Toggler", "dijit/form/DropDownButton", "dijit/form/ComboButton", "dijit/PopupMenuItem", "dijit/MenuSeparator", "dijit/TooltipDialog", "dojo/dnd/AutoSource", "dojo/dnd/Target"],
      }
}
};

4)      Create “mydojo.js”  file and store this file inside in <dojo src folder>\dojo folder .  This is a layer file for dojo custom build as per project structure.
define([
                "dojo/parser",
                "dijit/dijit",
                "dojo/data/ItemFileReadStore",
                "dojo/data/ItemFileWriteStore",
                "dijit/layout/ContentPane",
                "dijit/layout/BorderContainer",
                "dijit/layout/TabContainer",
                "dijit/layout/StackContainer",
                "dijit/Tree",
                 "dijit/layout/AccordionPane",
                 "dijit/layout/AccordionContainer",
                 "dijit/Dialog",
                 "dijit/tree/ForestStoreModel",
                 "dijit/form/Button",
                 "dijit/form/ToggleButton",
                 "dojox/grid/TreeGrid",
                 "dojox/grid/DataGrid"],function(parser,dijit,ItemFileReadStore,ItemFileWriteStore,ContentPane,BorderContainer,TabContainer,StackContainer,Tree,AccordionPane,AccordionContainer,Dialog,ForestStoreModel,Button,ToggleButton,TreeGrid,DataGrid){
 });
5)      Run build.bat --profile ./myprofile –release command from  <dojo src folder>\util\buildscripts location.

6)      Custom build would be created inside <dojo src folder>\ dojoRelease

7)      The dojoRelease folder will contain dojo 1.7.2 custom build.

No comments:

Post a Comment