⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 the package system and custom builds the dojo toolkit.mht

📁 dojo学习资料,从初级开始学起,是初学都认识dojo的好帮手.
💻 MHT
📖 第 1 页 / 共 5 页
字号:
de-subversion">Use=20
  Subversion</A> page. </LI></UL>
<H3>Creating a Custom Profile</H3>
<P>In the src/buildscripts/profiles directory, you will create a profile =
build=20
file called foo.profile.js like this:</P>
<DIV class=3Dgeshifilter style=3D"FONT-FAMILY: monospace">dependencies =
=3D<SPAN=20
class=3Dbr0>{</SPAN><BR class=3Dgeshibr>&nbsp; &nbsp; layers:&nbsp; =
<SPAN=20
class=3Dbr0>[</SPAN> <BR>&nbsp; &nbsp; &nbsp; &nbsp; <SPAN=20
class=3Dbr0>{</SPAN><BR>&nbsp; &nbsp; &nbsp; &nbsp; <SPAN =
class=3Dkw3>name</SPAN>:=20
<SPAN class=3Dst0>"mydojo.js"</SPAN>,<BR>&nbsp; &nbsp; &nbsp; &nbsp; =
dependencies:=20
<SPAN class=3Dbr0>[</SPAN><BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
<SPAN=20
class=3Dst0>"dijit.Button"</SPAN>, <BR>&nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
<SPAN class=3Dst0>"dojox.wire.Wire"</SPAN>,<BR>&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
&nbsp; <SPAN class=3Dst0>"dojox.wire.XmlWire"</SPAN>,<BR>&nbsp; &nbsp; =
&nbsp;=20
&nbsp; &nbsp; &nbsp; <SPAN=20
class=3Dst0>"explosive.space.Modulator"</SPAN><BR>&nbsp; &nbsp; &nbsp; =
&nbsp;=20
<SPAN class=3Dbr0>]</SPAN><BR>&nbsp; &nbsp; &nbsp; &nbsp; <SPAN=20
class=3Dbr0>}</SPAN><BR>&nbsp; &nbsp; <SPAN class=3Dbr0>]</SPAN>,<BR=20
class=3Dgeshibr>&nbsp; &nbsp; prefixes: <SPAN =
class=3Dbr0>[</SPAN><BR>&nbsp; &nbsp;=20
&nbsp; &nbsp; <SPAN class=3Dbr0>[</SPAN> <SPAN =
class=3Dst0>"dijit"</SPAN>, <SPAN=20
class=3Dst0>"../dijit"</SPAN> <SPAN class=3Dbr0>]</SPAN>,<BR>&nbsp; =
&nbsp; &nbsp;=20
&nbsp; <SPAN class=3Dbr0>[</SPAN> <SPAN class=3Dst0>"dojox"</SPAN>, =
<SPAN=20
class=3Dst0>"../dojox"</SPAN> <SPAN class=3Dbr0>]</SPAN>,<BR>&nbsp; =
&nbsp; &nbsp;=20
&nbsp; <SPAN class=3Dbr0>[</SPAN> <SPAN class=3Dst0>"explosive"</SPAN>, =
<SPAN=20
class=3Dst0>"../../explosive"</SPAN> <SPAN =
class=3Dbr0>]</SPAN><BR>&nbsp; &nbsp;=20
<SPAN class=3Dbr0>]</SPAN><BR class=3Dgeshibr><SPAN =
class=3Dbr0>}</SPAN>;</DIV>
<P>The dependencies section within the layer lists all the modules you =
call=20
<I>directly</I>. Any referenced modules will also be included, so you =
don't have=20
to trace back the dependency tree. Also, Dojo base modules are an =
implicit=20
dependency, so you don't need to list things like "dojo.query". (Dojo =
core=20
modules, however, do need to be listed.) </P>
<P>The modules for that layer are gathered together to make the "layer" =
file, in=20
our example: "mydojo.js". Then you just load this layer file in your =
pages with=20
a SCRIPT tag. Easy!</P>
<P>The prefixes section list any modules that need inclusion. Note our=20
"explosive" module, which is located away from the Dojo tree. You need =
to list=20
these if you use them, even if you don't want any modules from it in =
your layer=20
file. </P>
<P>For the 1.0+: If you choose to optimize the JS files in a prefix =
directory=20
(via the optimize=3D build parameter), you can choose to have a custom =
copyright=20
text prepended to the optimized file. To do this, specify the path to a =
file tha=20
contains the copyright info as the third array item in the prefixes =
array. For=20
instance:</P>
<DIV class=3Dgeshifilter style=3D"FONT-FAMILY: monospace">prefixes: =
<SPAN=20
class=3Dbr0>[</SPAN><BR>&nbsp; &nbsp; <SPAN class=3Dbr0>[</SPAN> <SPAN=20
class=3Dst0>"explosive"</SPAN>, <SPAN =
class=3Dst0>"../../explosive"</SPAN>, <SPAN=20
class=3Dst0>"../../explosive/copyright.txt"</SPAN><SPAN=20
class=3Dbr0>]</SPAN><BR><SPAN class=3Dbr0>]</SPAN></DIV>
<P>If no copyright is specified in this optimize case, then by default, =
the dojo=20
copyright will be used.</P>
<P></P>
<H3>Running The Build</H3>
<P>After specifying a profile file as shown above that statically =
specifies the=20
resources you want to include, and saving it as=20
/buildscripts/profiles/foo.profile.js, you run the Rhino interpreter on =
it and=20
specify the profile name as a parameter. For example, from the =
buildscripts=20
directory:</P>
<DIV class=3Dgeshifilter style=3D"FONT-FAMILY: monospace">$ <SPAN=20
class=3Dkw3>cd</SPAN> util/buildscripts<BR>$ build.sh <SPAN=20
class=3Dre2>profile=3D</SPAN>foo <SPAN =
class=3Dre2>action=3D</SPAN>release</DIV>
<P>On Windows PC's, substitute build.bat for build.sh. For both =
platforms, you=20
may also specify additional build options. Run build.sh to see a list of =
all=20
supported options. Here is a sample of the supported options: </P>
<TABLE>
  <TBODY>
  <TR class=3Dodd>
    <TD class=3Dforum>profile</TD>
    <TD class=3Dposts>The name of the profile to use for the build. It =
must be=20
      the first part of the profile file name in the profiles/ =
directory. For=20
      instance, to use base.profile.js, specify profile=3Dbase. Default: =

base</TD></TR>
  <TR class=3Deven>
    <TD class=3Dforum>profileFile</TD>
    <TD class=3Dposts>A file path to the the profile file. Use this if =
your=20
      profile is outside of the profiles directory. Do not specify the =
"profile"=20
      build option if you use "profileFile" Default: "",</TD></TR>
  <TR class=3Dodd>
    <TD class=3Dforum>action</TD>
    <TD class=3Dposts>The build action(s) to run. Can be a =
comma-separated list,=20
      like action=3Dclean,release. The possible build actions are: =
clean, release=20
      Default: "help",</TD></TR>
  <TR class=3Deven>
    <TD class=3Dforum>version</TD>
    <TD class=3Dposts>The build will be stamped with this version string =

      Default: "0.0.0.dev",</TD></TR>
  <TR class=3Dodd>
    <TD class=3Dforum>localeList </TD>
    <TD class=3Dposts>The set of locales to use when flattening i18n =
bundles=20
      Default:=20
      =
"en-gb,en-us,de-de,es-es,fr-fr,it-it,pt-br,ko-kr,zh-tw,zh-cn,ja-jp",</TD>=
</TR>
  <TR class=3Deven>
    <TD class=3Dforum>releaseName </TD>
    <TD class=3Dposts>The name of the release. A directory inside =
'releaseDir'=20
      will be created with this name Default: "dojo",</TD></TR>
  <TR class=3Dodd>
    <TD class=3Dname>releaseDir </TD>
    <TD class=3Dposts>The top level release directory where builds end =
up. The=20
      'releaseName' directories will be placed inside this directory =
Default:=20
      "../../release/",</TD></TR>
  <TR class=3Deven>
    <TD class=3Dforum>loader</TD>
    <TD class=3Dposts>The type of dojo loader to use. "default" or =
"xdomain" are=20
      acceptable values." defaultValue: "default",</TD></TR>
  <TR class=3Dodd>
    <TD class=3Dforum>internStrings</TD>
    <TD class=3Dposts>Turn on or off widget template/dojo.uri.cache() =
file=20
      interning Default: true,</TD></TR>
  <TR class=3Deven>
    <TD class=3Dforum>optimize</TD>
    <TD class=3Dposts>Specifies how to optimize module files. If =
"comments" is=20
      specified, then code comments are stripped. If "shrinksafe" is =
specified,=20
      then the Dojo compressor will be used on the files, and line =
returns will=20
      be removed. If "shrinksafe.keepLines" is specified, then the Dojo=20
      compressor will be used on the files, and line returns will be =
preserved.=20
      If "packer" is specified, Then Dean Edwards' Packer will be used =
Default:=20
      "",</TD></TR>
  <TR class=3Dodd>
    <TD class=3Dforum>layerOptimize</TD>
    <TD class=3Dposts>Specifies how to optimize the layer files. If =
"comments"=20
      is specified, then code comments are stripped. If "shrinksafe" is=20
      specified, then the Dojo compressor will be used on the files, and =
line=20
      returns will be removed. If "shrinksafe.keepLines" is specified, =
then the=20
      Dojo compressor will be used on the layer files, and line returns =
will be=20
      preserved. If "packer" is specified, Then Dean Edwards' Packer =
will be=20
      used Default: "shrinksafe",</TD></TR>
  <TR class=3Deven>
    <TD class=3Dforum>copyTests</TD>
    <TD class=3Dposts>Turn on or off copying of test files Default: =
true,</TD></TR>
  <TR class=3Dodd>
    <TD class=3Dforum>log</TD>
    <TD class=3Dposts>Sets the logging verbosity. See jslib/logger.js =
for=20
      possible integer values Default: logger.TRACE,</TD></TR>
  <TR class=3Deven>
    <TD class=3Dforum>xdDojoPath</TD>
    <TD class=3Dposts>If the loader=3Dxdomain build option is used, then =
the value=20
      of this option will be used for the path to Dojo modules. The =
dijit and=20
      dojox paths will be assumed to be sibilings of this path. The =
xdDojoPath=20
      should end in '/dojo' Default: "",</TD></TD></TR></TBODY></TABLE>
<H3>Cross Domain (XDomain) Builds</H3>
<P>Doing an xdomain build allows you to load Dojo and your custom =
modules from=20
another domain. The benefits to doing this are listed in the <A=20
href=3D"http://dojotoolkit.org/book/dojo-book-0-4/part-6-customizing-dojo=
-builds-better-performance/cross-domain-resource-loading">0.4=20
Book page about Cross Domain Resource Loading</A>.</P>
<P>To do an xdomain build:</P>
<DIV class=3Dgeshifilter style=3D"FONT-FAMILY: monospace">$ <SPAN=20
class=3Dkw3>cd</SPAN> util/buildscripts<BR>$ build.sh <SPAN=20
class=3Dre2>profile=3D</SPAN>foo <SPAN =
class=3Dre2>loader=3D</SPAN>xdomain <SPAN=20
class=3Dre2>xdDojoPath=3D</SPAN>http://my.server.com/path/to/buildoutputd=
ir <SPAN=20
class=3Dre2>action=3D</SPAN>release</DIV>
<P>xdDojoPath is optional. It just burns in the location of dojo, dijit =
and=20
dojox into the built dojo.js. If you do not specify that option, then =
you will=20
need to use djConfig.modulePaths/dojo.registerModulePath() in your HTML =
page to=20
set the xdomain locations for dojo, dijit and dojox. For your own custom =

modules, you will have to set =
djConfig.modulePaths/dojo.registerModulePath()=20
even if you us the xdDojoPath build option.</P>
<P><B>For 0.9+ there is a <A =
href=3D"http://trac.dojotoolkit.org/ticket/4462">bug=20
about loading dojox.gfx with an xdomain build</A>.</B>. If you want to =
use=20
dojox.gfx with an xdomain build, there are some workarounds until the =
bug gets=20
fixed:</P>
<OL>
  <LI>Include dojox/gfx.js directly in your page with a script tag in =
the HTML=20
  source, after the dojo.js script tag (do not use gfx.xd.js, use =
gfx.js).=20
  <LI>Include dojox.gfx in a layer file that you load via a script tag =
in the=20
  HTML source (load the .js layer file, not the .xd.js layer file). =
</LI></OL>
<DIV class=3Dbook-navigation>
<DIV class=3D"page-links clear-block"><A class=3Dpage-previous=20
title=3D"Go to previous page"=20
href=3D"http://dojotoolkit.org/book/dojo-book-0-9/part-4-meta-dojo/perfor=
mance-optimization">=E2=80=B9=20
Performance Optimization</A><A class=3Dpage-up title=3D"Go to parent =
page"=20
href=3D"http://dojotoolkit.org/book/dojo-book-0-9/part-4-meta-dojo-0">up<=
/A><A=20
class=3Dpage-next title=3D"Go to next page"=20
href=3D"http://dojotoolkit.org/book/dojo-book-0-9/part-5-dojox-extensions=
-dojo-0">Part=20
5: DojoX - Experimental and Specialized Extensions =
=E2=80=BA</A></DIV></DIV></DIV>
<DIV class=3Dlinks>
<UL class=3D"links inline">
  <LI class=3D"first book_printer"><A class=3Dbook_printer=20
  title=3D"Show a printer-friendly version of this book page and its =
sub-pages."=20
  href=3D"http://dojotoolkit.org/book/export/html/1639">Printer-friendly =

  version</A>=20
  <LI class=3Dcomment_forbidden><SPAN class=3Dcomment_forbidden><A=20
  =
href=3D"http://dojotoolkit.org/user/login?destination=3Dnode/1639%2523com=
ment-form">Login</A>=20
  or <A=20
  =
href=3D"http://dojotoolkit.org/user/register?destination=3Dnode/1639%2523=
comment-form">register</A>=20
  to post comments</SPAN>=20
  <LI class=3D"last subscriptions_add_node"><A =
class=3Dsubscriptions_add_node=20
  title=3D"Receive an e-mail whenever a comment is posted to this Book =
page."=20
  href=3D"http://dojotoolkit.org/subscriptions/add/node/1639">Subscribe =
post</A>=20
  </LI></UL></DIV></DIV>
<DIV id=3Dcomments></DIV><!-- /main_content region --></DIV></DIV>
<DIV class=3D"col-c content-region-container">
<DIV id=3Dsidebar-right-container></DIV></DIV><BR class=3Dclear></DIV>
<DIV class=3Dcols-a50b50 id=3Dafter-content-block>
<DIV class=3D"col-a content-region-container" =
id=3Dafter-content-block-1></DIV>
<DIV class=3D"col-b content-region-container" =
id=3Dafter-content-block-2><BR=20
class=3Dclear></DIV><BR class=3Dclear></DIV><BR clear=3Dall></DIV>
<DIV class=3Dcontent-region-container>
<DIV id=3Dnavigation-block>
<DIV id=3Dbreadcrumb-block>
<DIV id=3Dbreadcrumbs>
<DIV class=3Dbreadcrumb><A href=3D"http://dojotoolkit.org/">Home</A> =
=C2=BB <A=20
href=3D"http://dojotoolkit.org/book/dojo-book-0-9-0">The Book of =
Dojo</A> =C2=BB <A=20
href=3D"http://dojotoolkit.org/book/dojo-book-0-9/part-4-meta-dojo-0">Par=
t 4:=20
Testing, Tuning and Debugging</A> =C2=BB The Package System and Custom=20
Builds</DIV></DIV></DIV>
<DIV class=3Dcols-abcd id=3Dmain-menu-block><!-- Block: menu -->
<DIV class=3D"block block-menu" id=3Dblock-menu-573>
<DIV class=3Dcontent>
<UL class=3Dmenu>
  <LI class=3Dleaf id=3Dmenu-item-574><A title=3D"See the Dojo Toolkit =
in action!"=20
  href=3D"http://dojotoolkit.org/demos">Demos</A>=20
  <LI class=3Dexpanded id=3Dmenu-item-575><A=20
  title=3D"Get started with the Dojo Toolkit, fast"=20
  href=3D"http://dojotoolkit.org/docs/quickstart">Quick Start</A>=20
  <UL class=3Dmenu>
    <LI class=3Dleaf id=3Dmenu-item-576><A title=3D"Get the toolkit"=20
    href=3D"http://dojotoolkit.org/downloads">Downloads</A>=20
    <LI class=3Dleaf id=3Dmenu-item-577><A title=3D"See examples of the =
Dojo Toolkit"=20
    href=3D"http://dojotoolkit.org/demos">Examples</A>=20
    <LI class=3Dleaf id=3Dmenu-item-639><A=20
    href=3D"http://dojotoolkit.org/spotlight">Spotlight</A> </LI></UL>
  <LI class=3Dexpanded id=3Dmenu-item-578><A=20
  href=3D"http://dojotoolkit.org/about">About</A>=20
  <UL class=3Dmenu>
    <LI class=3Dleaf id=3Dmenu-item-579><A=20
    href=3D"http://dojotoolkit.org/about">Overview</A>=20
    <LI class=3Dleaf id=3Dmenu-item-580><A=20
    href=3D"http://dojotoolkit.org/about/features">Features</A>=20
    <LI class=3Dleaf id=3Dmenu-item-581><A=20
    href=3D"http://dojotoolkit.org/about/press">Press</A>=20
    <LI class=3Dleaf id=3Dmenu-item-582><A=20
    href=3D"http://dojotoolkit.org/about/contact">Contact</A>=20
</LI></UL></LI></UL></DIV></DIV><!-- Block: menu -->
<DIV class=3D"block block-menu" id=3Dblock-menu-589>
<DIV class=3Dcontent>
<UL class=3Dmenu>
  <LI class=3Dexpanded id=3Dmenu-item-583><A=20
  href=3D"http://dojotoolkit.org/downloads">Downloads</A>=20
  <UL class=3Dmenu>
    <LI class=3Dleaf id=3Dmenu-item-584><A=20
    href=3D"http://dojotoolkit.org/downloads">Current releases</A>=20
    <LI class=3Dleaf id=3Dmenu-item-585><A=20
    href=3D"http://archive.dojotoolkit.org/nightly/">Nightly builds</A>=20
    <LI class=3Dleaf id=3Dmenu-item-586><A=20
    href=3D"http://archive.dojotoolkit.org/">Archives</A>=20
    <LI class=3Dleaf id=3Dmenu-item-587><A=20
    href=3D"http://trac.dojotoolkit.org/roadmap?show=3Dall">Change =
logs</A>=20
    <LI class=3Dleaf id=3Dmenu-item-588><A=20
    href=3D"http://dojotoolkit.org/downloads/releasenotes">Release =
notes</A>=20
  </LI></UL>
  <LI class=3Dexpanded id=3Dmenu-item-590><A=20
  href=3D"http://dojotoolkit.org/news">News</A>=20
  <UL class=3Dmenu>
    <LI class=3Dleaf id=3Dmenu-item-591><A=20
    href=3D"http://dojotoolkit.org/blog">Blogs</A>=20
    <LI class=3Dleaf id=3Dmenu-item-592><A=20
    =
href=3D"http://dojotoolkit.org/topics/news/announcements">Announcements</=
A>=20
    <LI class=3Dleaf id=3Dmenu-item-593><A=20
    href=3D"http://dojotoolkit.org/aggregator">Planet Dojo</A>=20

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -