Dojo custom build getting browser errors due to missing resources -
i've been struggling learning amd based dojo build system. far haven't been able build usable without getting load errors in browser (ff).
i have questions how manage build.
my build profile file has packages section. specify there seems directly correlate same package directories being written destination directory. seems appropriate. however, have layers section trying merge "referenced" modules dojo, dijit, dojox, etc. when combined 1 dojo.js file, still have library directories in destination dir. understood manually go in , remove them or there automatic way them removed during build?
in first layer try build dojo, dijit , dojox/app/main. not pulling on resources, such dojo/resources/blank.gif or .css files in same directory. how 1 resource files copy on destination? believe dojo.profile.js (which indicate copy resources) impacts dojo directory. since creating custom dojo/dijit/dojox file combines js modules, there no resources directory. after custom build, supposed manually go dojo directory , move dojo/resources dir out toss rest of dojo dir? not sure how dependent img , css files accessible in dojo dir use custom dojo.js layer file when dojo/dijit layer built.
here's build profile:
var profile = { basepath: "./", //releasedir: "irb-release", action: "release", cssoptimize: "comments", stripconsole: 'all', selectorengine: 'acme', layeroptimize: 'closure', optimize: 'closure', mini: true, packages:[ { name: "dojo", location: "../libs/dojo" }, { name: "dijit", location: "../libs/dijit" }, { name: "dojox", location: "../libs/dojox" }, { name: "dgrid", location: "../libs/dgrid" }, { name: "put-selector", location: "../libs/put-selector" }, { name: "xstyle", location: "../libs/xstyle" }, { name: "mypkg", location: "../libs/mypkg" }, { name: "irb", location: "../irb" } ], layers: { "release/irb/libs/dojo": { include: ["dojo/dojo", "dijit/dijit", "dojox/app/main"], boot: true, custombase: true }, "release/irb/libs/mypkg": { include: [ "mypkg/dialog/messagebox", "mypkg/grids/filtergrid", "mypkg/util/widgetmonitor", "mypkg/controllers/borderlayout", "mypkg/controllers/unloadviewcontroller" ], includelocales: [ 'en-us' ] }, "release/irb/libs/store/memory": { include: [ "dojo/store/memory" ] }, "release/irb/libs/store/observable": { include: [ "dojo/store/observable" ] }, "irb/irb": { include: [ "irb/irb", "dojox/app/view", "dojox/css3/transit", "dojox/app/controllers/load", "dojox/app/controllers/transition", "dojox/app/controllers/history" ] } }, statichasfeatures: { // trace & log apis used debugging loader, not need them in build. 'dojo-trace-api': 0, 'dojo-log-api': 0, // causes private loader data exposed debugging. in release build, not need // either. 'dojo-publish-privates': 0, // application pure amd, rid of legacy loader. 'dojo-sync-loader': 0, // `dojo-xhr-factory` relies on `dojo-sync-loader`, have removed. 'dojo-xhr-factory': 0, // not loading tests in production, can rid of test sniffing code. 'dojo-test-sniff': 0 } }; update: here directory structure approx. based on dojox/app structure:
/(webroot) /irb /controllers /res /css /img /views build.sh config.json index.html irb.js package.js package.json release.profile.js /libs /dgrid /dijit /dojo /dojox /mypkg /put-selector /util /xstyle for build use build.sh file based on dojox/app example internal command line calls is:
node "/home/(user)/(project ... path)/(webroot)/libs/dojo/dojo.sh" load=build --require "/home/(user)/(project ... path)/(webroot)/irb/irb.js" --profile "/home/(user)/(project ... path)/(webroot)/irb/release.profile.js" --appconfigfile "/home/(user)/(project ... path)/(webroot)/irb/config.json" --releasedir "/home/(user)/(project ... path)/(webroot)/build"
extra files , directories
i think practice not remove them. reason performing build improve web browser performance combining used few (preferably one) javascript file.
but happens if file(module) used not included in layer. if have other files in build directory, application still work, have additional call server file. if have removed these directories , files, application break.
pulling on resources
after doing custom build, have
release/release_name/dojo/resources directory, contains resources mentioned.
edit: adding example...
example
command
node path/to/dojo/dojo.js load=build --profile path/to/build.profile.js --release --version=1.9.0 build.profile.js
var profile = (function(){ return { // assuming node command being run in // webroot directory. if not, update basepath // libs directory using current directory // starting point. basepath: "./libs", releasedir: "/path/to/release/dir", action: "release", releasename: "release", layeroptimize: "shrinksafe", optimize: false, cssoptimize: "comments", mini: false, stripconsole: "normal", selectorengine: "acme", packages:[ {name: 'dojo', location: 'dojo'}, {name: 'dijit', location: 'dijit'}, {name: 'dojox', location: 'dojox'}, {name: 'dgrid', location: 'dgrid'}, {name: 'put-selector', location: 'put-selector'}, {name: 'xstyle', location: 'xstyle'} {name: 'irb', location: '../irb'}, ], layers: { 'irb/dojo": { include: ["dojo/dojo", "dijit/dijit", "dojox/app/main"], boot: true, custombase: true }, ... } }; })();
Comments
Post a Comment