Build (or compressed) in dojo

Reference article: http://www.ibm.com/developerworks /cn/web/0912_shenjc_dojobuild/

1. The tool is in /dojo/util/buildscriptsNext,build.batfile span>

Command: build profile=example action=release releaseName=myDojo optimize=shrinksafe

Profile :SpecifybuildUse profilefile (profileThe file needs to be placed/dojo/util/ buildscripts/profiles中);

Action: Specify the type of this command, there are three values:clean,release ,help;

releaseName: This timerelease’s name, the default is dojo;

Optimize: this timebuildThe optimization method in , generally useshrinksageSimply;

2.profilesFile

/* example.profile.js */ dependencies = {layers: [/ / You can make multiple different layers according to your needs {name: "example.js", // The name of the packaged js file dependencies: [// The list of js files that need to be packaged "dojo.date", "dojox.uuid" ]} ], prefixes: [// Set the path ["dijit", "../dijit" ], ["dojox", "../dojox"]] }

3. The location of the file:

In action/releaseName/dojo/, there are profile.js (compressed) and profile.uncompressed.js (uncompressed)

This example file is release/myDojo/dojo/example.js

4. Attach a more advanced profile

< pre name="code" class="html">/* example.profile.js */ dependencies = {layers: [{// This layer is used to package our customized dojo file name: “mydojo.js”, dependencies: [“dojo.date”, “dojox.uuid”] }, {// This layer is used to package our own js file name: “example.js”, dependencies: [“my.example1”]} ], prefixes: [[“dijit”, “../dijit” ], [“dojox”, “../dojox” ], [“my”, “../my”]] }

——————————————-Dividing line—- ————————————————– —

The above content is actually too old, and for beginners, the writing is not specific enough! At least tortured me for two days! anger. Today I will improve it, hoping that people will not fall into this pit again.

Dojo’s official website has a create build article, which is authoritative, but for combatists, how to write it is the most important. Below I will post the content of the profile.js file.

The content of the myapp.profile.js file:

var profile = (function(){ return {basePath: "../../../../js", //The path relative to the profile.js file, for example, I like to put the profile.js file in the util->buildScript->profiles folder Next releaseDir: "./app", //Relative to the basePath path, now basePath has been located under the js folder releaseName: "lib", //Add the releaseDir file, here is a lib file created in the app folder Folder action: "release", layerOptimize: "closure", optimize: "closure", cssOptimize: "comments", mini: true, stripConsole: "warn", selectorEngine: "lite", defaultConfig: {hasCache:{ "dojo- built": 1, "dojo-loader": 1, "dom": 1, "host-browser": 1, "config-selectorEngine": "lite" }, async: 1 }, staticHasFeatures: {"config-deferredInstrumentation ": 0, "config-dojo-loader-catches": 0, "config-tlmSiblingOfDojo": 0, "dojo-a md-factory-scan": 0, "dojo-combo-api": 0, "dojo-config-api": 1, "dojo-config-require": 0, "dojo-debug-messages": 0, " dojo-dom-ready-api": 1, "dojo-firebug": 0, "dojo-guarantee-console": 1, "dojo-has-api": 1, "dojo-inject-api": 1, " dojo-loader": 1, "dojo-log-api": 0, "dojo-modulePaths": 0, "dojo-moduleUrl": 0, "dojo-publish-privates": 0, "dojo-requirejs-api" : 0, "dojo-sniff": 1, "dojo-sync-loader": 0, "dojo-test-sniff": 0, "dojo-timeout-api": 0, "dojo-trace-api": 0 , "dojo-undef-api": 0, "dojo-v1x-i18n-Api": 1, "dom": 1, "host-browser": 1, "extend-dojo": 1 }, packages:[{ name: "dojo", location: "dojo" },{ name: "dijit", location: "dijit" },{ name: "dojox", location: "dojox" },{ name: "cbtree", //You can put some extension packages here, such as your own package location: "cbtree" }], layers: {"dojo/dojo" : {include: ["dojo/dojo", "dojo/i18n", "dijit/registry", "dojo/ready", "dijit/Tree", "dijit/form/CheckBox", "dojo/store/Memory" , // basic dojo/store "cbtree/Tree", // Checkbox tree "cbtree/model/TreeStoreModel", // ObjectStoreModel "dijit/layout/BorderContainer", "dojox/layout/ContentPane", "dijit/layout/TabContainer ", "dojo/store/JsonRest", "dojo/store/Observable",'dojo/_base/array', "dojo/request/xhr", "dojo/on", "dojox/grid/EnhancedGrid", "dojo /data/ItemFileWriteStore", "dojo/dom", "dojo/parser", "dojo/domReady" ], customBase: true, boot: true}} };})();< /pre> 
Then open cmd->cd to the util/buildScripts/ folder,

Run: build.bat --profile ./profiles/myapp.profile.js

p>

Then a cup of coffee!

The console will have a bunch of output, and finally, it will display error or other information

******************** ******************************Very important****************** ***********************************************

The key is here! The program will generate app/lib/ in the js folder. . . Package, copy the generated dojo, dijit, dojox files into the project, and then reference the generated dojo.js file.

I always thought that the dojo, dijit, dojox and other files generated after the dojo build do not need to be copied into the project, but just copy the dojo.js file to the project, but the event tells you We can't do this, we need to put several generated files together in the project.

Leave a Comment

Your email address will not be published.