ExtJS4的build工具

     用extjs4开发了一个前端。ExtJS4的变化非常打,规范了ExtJS4的MVC开发模式。这下JS开发大型项目变得轻松了很多。赞!

本文记录一下extjs的打包。大部分内容来自官方文档。

实践中碰到的问题
  • 在我的项目中,-a localfile不work,-a http://xxxx就可以了。很奇怪,html/js代码中没有动态内容。官方网站对此问题的讨论见此帖:
    http://www.sencha.com/forum/showthread.php?136032-SDKTOOLS-3-buggy-Sencha-SDK-Tools
  • jsb3默认入口js是%jsb3 file name%.js。如果找不到该文件,在build的时候不报错,但是生成app-all的时候会缺少入口文件,手工修改一下jsb3文件就好了。

EXTJs打包:

sencha create jsb -a index.html -p app.jsb3
或者:
sencha create jsb -a http://localhost/helloext/index.html -p app.jsb3
然后会得到一个jsb3文件,(JSBuilder file format) JSBuilder是Sencha 自己的工具。
然后:
sencha build -p app.jsb3 -d .
然后工具会生成2个JS文件:
all-classes.js
This file contains all of your application’s classes. It is not minified so is very useful for debugging problems with your built application. In our example this file is empty because our “Hello Ext” application does not contain any classes.

app-all.js
This file is a minimized build of your application plus all of the Ext JS classes required to run it. It is the minified and production-ready version of all-classes.js + app.js.
生产环境下使用如下的文件:
<html>   <head>     <title>Hello Ext</title>     <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">     <script type="text/javascript" src="extjs/ext.js"></script>     <script type="text/javascript" src="app-all.js"></script>   </head>   <body></body> </html> 

注意:其中用ext.js代替了ext-debug.js, app-all.js 代替了app.js
最后:
快!
工具下载:

http://www.sencha.com/products/sdk-tools/download/ 

转载于:https://www.cnblogs.com/Kane_zzt/archive/2012/11/23/2784557.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值