dojo build system 可以用来扫描,优化JavaScript代码和CSS代码,并最小化。用于部署优化等等。
首先要按装nodejs,不在本文描述。
之后下载dojo toolkit sdk : http://download.dojotoolkit.org/release-1.9.1/dojo-release-1.9.1-src.tar.gz
解压后放在~/work目录下,已经可以用了。
查看帮助信息的方式:
~/work/dojo-release-1.9.1-src/util/buildscripts$ node ../../dojo/dojo.js load=build --help
NAME
The Dojo Builder - Read, process, and write a set of resources as instructed by a profile.
DESCRIPTION
Discover and process a set of resources with an ordered synchronized set of transforms.
See http://dojotoolkit.org/reference-guide/build/index.html for reference documentation.
See http://dojotoolkit.org/reference-guide/build/qref.html for a quick reference manual.
Typically this program is executed with the convience wrapper /util/buildscripts/build.bat (Window) or
/util/buildscripts/build.sh (all other environments); it may also be executed explicitly.
Usage with the build script on non-windows:
path/to/util/buildscripts/build.sh [options]
Usage with the build script on windows:
IMPORTANT: the util/buildscripts directory must be the current working directory
build.bat [options]
Explicit usage with node.js:
node path/to/dojo/dojo.js load=build [options]
Explicit usage with java:
java -Xms256m -Xmx256m -jar path/to/util/shrinksafe/js.jar path/to/dojo/dojo.js baseUrl=path/to/dojo load=build [options]
IMPORTANT:
This program assumes the default directory structure provided with the standard dojo source release.
IMPORTANT:
When using v1.6- profiles, this program assumes the current working directory is utils/buildscripts.
OPTIONS
-p <filename>
--profile <filename> read profile for file
-p <profile>
--profile <profile> read profile from profile in util/buildscripts/profiles
--package <path> read profile from package.json located in the directory path
--require <filename>
--dojoConfig read profile from loader configuration
--htmlFiles <file-list> deduce profile from HTML file(s); file-list is a comma-separated list of filenames
--htmlDir <path> deduce profile from all HTML files in directory at path
--check-args print computed raw command line input, including raw profiles, then terminate
--check print computed profile, then terminate
--check-discovery print all discovered resources, then terminate
--debug-check print computed profile, including internal structures
-r
--release process the build control script(s) and/or profile(s) and transform sources into a release
--releaseDir <path> base directory for build output
--releaseName <string> path segment to append to releaseDir that gives base directory for build output
--layerOptimize <arg> process all layer resources in order to minimize resource size; arg as follows:
comments => remove comments with ShrinkSafe
comments.keeplines => as above, but don't remove newlines
shrinksafe => minimize with ShrinkSafe
shrinksafe.keeplines => as above, but don't remove newlines
closure => minimize with the Google Closure compiler
closure.keeplines => as above, but don't remove newlines
uglify => minimize with Uglify
uglify.keeplines => as above, but don't remove newlines
(note: all args are case-insensitive)
--optimize <arg> analogous to --layerOptimize, but applied to non-layer resources
--copyTests <arg> copy test files and the DOH package; arg as follows:
false => don't copy tests
true => copy test resources, but don't apply any transforms
build => copy and build tests resources just as if they were normal resources
--mini Ignore resources tagged as not mini (e.g. tests, demos dijit/bench, etc.)
-v print the program's version number
--help this help message
Scalar profile property values may also be specified as options with the syntax
--<profile-property-name> <value>
1.7.0dev (23930)
running under node
如果是apt-get install方式安装nodejs,命令应该是nodejs而不是node, 我这里是编译安装的。
不过命令不需要那么长,因为有build.sh脚本,如下使用:
~/work/dojo-release-1.9.1-src/util/buildscripts$ ./build.sh --help