很實在的一個需求,就是我們只需要extjs的一部分功能,不想把整個類庫都包含進(jìn)來.
所以讓我們來定制extjs吧~
1. ExtJS 1.1.1或2.3.0
可以用官方的在線工具來定制:http://extjs.com/products/extjs/build/
使用教程:
e文:http://extjs.com/learn/Tutorial:Building_Ext_From_Source
中文:http://extjs.org.cn/node/364
2. EXTJS 3.0
現(xiàn)在還沒有在線版,可以通過以下方法來自己定制:
1. 下載Ext 3.0.0 SDK. http://extjs.com/products/extjs/download.php?dl=extjs3
2. 下載JSBuilder2. http://extjs.com/products/jsbuilder/ (或者看文末的附件)
3. 下載Ext 3.0.0的ext.jsb2文件 http://extjs.com/forum/showthread.php?p=354473 (或者看文末的附件)
4. 把JSBuilder2解壓jar到extjs根目錄下,ext.jsb2也放到根目錄下
5. 用你的文本編輯器編輯ext.jsb2文件,僅保留你需要的模塊
6. jsb2文件中的deployDir: 'ext-3.0.0-build'表示相對輸出目錄
7. cmd,切換到ext根目錄下,執(zhí)行:
G:\Learning\Web\Javascript\ExtJS\ext-3.0.0> java -jar "JSBuilder2.jar" -p ./ext.jsb2 -d ./
8.等待刷屏完畢后去你在jsb2中指定的目錄下找輸出吧.
3.試驗
一個試驗的例子,僅包含Tree組件,如附件
1) resource部分未作過濾
2) 注意依賴關(guān)系,如
name: 'Trees',
file: 'pkgs/pkg-tree.js',
isDebug: true,
pkgs: ['pkgs/cmp-foundation.js']
3)輸出的文件樹如下:
adapter\
|--ext\
|----ext-base.js
|----ext-base-debug.js
pkgs\
|--cmp-foundation.js
|--ext-foundation.js
|--pkg-tree.js
|--cmp-foundation-debug.js
|--ext-foundation-debug.js
|--pkg-tree-debug.js
resources\
license.txt