글
Web/Javascript 2009/11/10 19:15the dojo build system
the dojo build system
dojo는 성능의 향상을 위하여 build system을 제공한다.
dojo는 다양한 패키지로 이루어져 있으며, 그 패키지를 이용하여
자신의 서비스를 개발한다.
수천 수만개로 이루어진 패키지와 모듈을 그대로 어플리케이션을 서비스한다면,
그 어플리케이션의 성능은 매우 좋지 못할것이다.
때문에 dojo는 build system을 지원하여 성능의 향상을 꽤하였다.
* Dojo의 Build System은 나뉘어진 모듈들을 사용시 로딩이 길다는 단점을 해결하기 위해 경량화/압축 등을 통해 배포 성능을 높이기 위해 고안된 녀석이다는 말이다.
dojo의 build system을 이용한 build는 아래와 같은 방법을 통해 performance를 향상
시킨다
1. Layer를 call하는 것이 여러개의 모듈 js를 load하는것 보다 빠르다.
(Layer : 여러개의 js모듈을 하나로 몰아 놓은것)
2. Shrinksafe를 이용하여, compressing해 load와 parsing 속도를 높인다.
따라서 dojo build system은 특정 js모듈에 dependencies를 분석하여 하나의 Layer
를 만들어주고, 그 Layer파일을 Compress해 성능을 높여 주는 역할을 한다.
* dojo build system을 이용하여 module build하기
0. dijit, dojo, dojox, util로 구성된 dojo-src버전을 다운 받는다
util폴더에 build에 필요한 util들이 모두 구비되어있다.
1. Creating a Custom Profile
구성할 layer의 dependencies정보등을 가진 profile을 구성하여,
util\buildscripts\profiles 에 one.profile.js로 저장한다.
위 profile 정의는 mydojo.js라는 하나의 Layer를 정의한것이다.
이러한 과정을 통해 빌드된 결과 layer파일을
페이지에서 아래와 같이 로딩한다.
<script type="text/javascript" djConfig="isDebug:false,parseOnLoad:true,usePlainJson:true" src="../lib/release/dojo/dojo/one_dojo.js"></script>
참고 : http://docs.dojocampus.org/
dojo는 성능의 향상을 위하여 build system을 제공한다.
dojo는 다양한 패키지로 이루어져 있으며, 그 패키지를 이용하여
자신의 서비스를 개발한다.
수천 수만개로 이루어진 패키지와 모듈을 그대로 어플리케이션을 서비스한다면,
그 어플리케이션의 성능은 매우 좋지 못할것이다.
때문에 dojo는 build system을 지원하여 성능의 향상을 꽤하였다.
* Dojo의 Build System은 나뉘어진 모듈들을 사용시 로딩이 길다는 단점을 해결하기 위해 경량화/압축 등을 통해 배포 성능을 높이기 위해 고안된 녀석이다는 말이다.
dojo의 build system을 이용한 build는 아래와 같은 방법을 통해 performance를 향상
시킨다
1. Layer를 call하는 것이 여러개의 모듈 js를 load하는것 보다 빠르다.
(Layer : 여러개의 js모듈을 하나로 몰아 놓은것)
2. Shrinksafe를 이용하여, compressing해 load와 parsing 속도를 높인다.
따라서 dojo build system은 특정 js모듈에 dependencies를 분석하여 하나의 Layer
를 만들어주고, 그 Layer파일을 Compress해 성능을 높여 주는 역할을 한다.
* dojo build system을 이용하여 module build하기
0. dijit, dojo, dojox, util로 구성된 dojo-src버전을 다운 받는다
util폴더에 build에 필요한 util들이 모두 구비되어있다.
1. Creating a Custom Profile
구성할 layer의 dependencies정보등을 가진 profile을 구성하여,
util\buildscripts\profiles 에 one.profile.js로 저장한다.
dependencies ={
layers: [
{
name: "mydojo.js",
dependencies: [
"dijit.Button",
"dojox.wire.Wire",
"dojox.wire.XmlWire",
"explosive.space.Modulator"
]
}
],
prefixes: [
[ "dijit", "../dijit" ],
[ "dojox", "../dojox" ]
layers: [
{
name: "mydojo.js",
dependencies: [
"dijit.Button",
"dojox.wire.Wire",
"dojox.wire.XmlWire",
"explosive.space.Modulator"
]
}
],
prefixes: [
[ "dijit", "../dijit" ],
[ "dojox", "../dojox" ]
]
};
};
위 profile 정의는 mydojo.js라는 하나의 Layer를 정의한것이다.
Layer이란 single이다.
Multiple source files로부터 모든 자바 스크립트 코드를 의존성이 걸린 녀석을 모두 포함시켜서 합병 축소시킨 하나의 자바스크립트 파일 을 말한다.이 파일은 표준 HTML 스크립트 태그에 의해 포함되어 사용되어 질수 있다. 당신은 layer 파일을 당신의 웹페이지에 <script> tags로 로드하여 사용할수 있다.
브라우저가 스크립트와 동작하려고 Server로부터 모듈을 다운 받아 브라우저 캐쉬에 올릴때 multiple little files 보다 only one larger file을 로딩하는게 웹 페이지를 훨씬 빠르게 한다.
2. build를 argument와 함께 수행한다.
util\buildscripts에서 아래와 같은 형태로 미리준비한 one.profile.js를 이용해 build한다.
build profileFile=one action=release version=1.3.0 releaseName=leon
다양한 build option이 있는데, 아래와 같다.
| profile | The name of the profile to use for the build. It must be the first part of the profile file name in the profiles/ directory. For instance, to use base.profile.js, specify profile=base. Default: base |
| profileFile | A file path to the the profile file. Use this if your profile is outside of the profiles directory. Do not specify the "profile" build option if you use "profileFile" Default: "", |
| action | The build action(s) to run. Can be a comma-separated list, like action=clean,release. The possible build actions are: clean, release Default: "help", |
| version | The build will be stamped with this version string Default: "0.0.0.dev", |
| localeList | The set of locales to use when flattening i18n bundles Default: "en-gb,en-us,de-de,es-es,fr-fr,it-it,pt-br,ko-kr,zh-tw,zh-cn,ja-jp", |
| releaseName | The name of the release. A directory inside 'releaseDir' will be created with this name Default: "dojo", |
| releaseDir | The top level release directory where builds end up. The 'releaseName' directories will be placed inside this directory Default: "../../release/", |
| loader | The type of dojo loader to use. "default" or "xdomain" are acceptable values." defaultValue: "default", |
| internStrings | Turn on or off widget template/dojo.uri.cache() file interning Default: true, |
| optimize | Specifies how to optimize module files. If "comments" is specified, then code comments are stripped. If "shrinksafe" is specified, then the Dojo compressor will be used on the files, and line returns will be removed. If "shrinksafe.keepLines" is specified, then the Dojo compressor will be used on the files, and line returns will be preserved. If "packer" is specified, Then Dean Edwards' Packer will be used Default: "", |
| layerOptimize | Specifies how to optimize the layer files. If "comments" is specified, then code comments are stripped. If "shrinksafe" is specified, then the Dojo compressor will be used on the files, and line returns will be removed. If "shrinksafe.keepLines" is specified, then the Dojo compressor will be used on the layer files, and line returns will be preserved. If "packer" is specified, Then Dean Edwards' Packer will be used Default: "shrinksafe", |
| copyTests | Turn on or off copying of test files Default: true, |
| log | Sets the logging verbosity. See jslib/logger.js for possible integer values Default: logger.TRACE, |
| xdDojoPath | If the loader=xdomain build option is used, then the value of this option will be used for the path to Dojo modules. The dijit and dojox paths will be assumed to be sibilings of this path. The xdDojoPath should end in '/dojo' Default: "", |
이러한 과정을 통해 빌드된 결과 layer파일을
페이지에서 아래와 같이 로딩한다.
<script type="text/javascript" djConfig="isDebug:false,parseOnLoad:true,usePlainJson:true" src="../lib/release/dojo/dojo/one_dojo.js"></script>
참고 : http://docs.dojocampus.org/
'Web > Javascript' 카테고리의 다른 글
| Mac(Leopard,SnowLeopard) + Firefox 에서의 liveconnect 오동작 (0) | 2010/07/27 |
|---|---|
| Dojo Build System (0) | 2010/01/26 |
| the dojo build system (0) | 2009/11/10 |
| Javascript event model (0) | 2009/10/23 |
| DOM을 이용한 문서 구조 조작 (0) | 2009/10/23 |
| My JavaScript Study Summary Note (0) | 2009/10/15 |
RECENT COMMENT