使用 JSBuilder 或 Apache ANT 构建 Sencha Touch 应用程序
假设您已经使用一堆视图、控制器、模型、存储、实用程序等构建(编码)了 MVC Sencha Touch 应用程序...
“构建”用于生产用途的应用程序的最佳方法是什么?
任务是:
- 合并并缩小所有 JS 源文件
- 合并并缩小样式表(基本上在生产环境中运行 Compass)
- 删除不需要的文件夹
有人使用 JSBuilder 或 Apache Ant 完成过此操作吗?我发现与 Sencha Touch lib 集成的 JSBuilder 解决方案有很多错误并且没有文档记录。 Apache Ant 非常适合像 Jenkins 这样的“更大”构建或 CI 系统,但我错过了一个如何使用 Sencha Touch 应用程序实现这一目标的好例子。
所以问题是,Sencha Touch 的构建脚本应该是什么样的?
Assume you have built (coded) your MVC Sencha Touch App with a bunch of Views, Controllers, Models, Stores, Utils etc...
Whats the best way to "build" the application for production use?
Tasks would be:
- Concat and minify all JS Source Files
- Concat and minify Stylesheets (basically running Compass with production environment)
- Remove not needed folders
Has anyone done this yet with either JSBuilder or Apache Ant? I find the JSBuilder solution integrated with the Sencha Touch lib quite buggy and undocumented. Apache Ant would perfectly fit in with "bigger" build- or CI-systems like Jenkins but I miss a good example how to achive this with a Sencha Touch app.
So the question is, how should a build script for Sencha Touch look like?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:警告:这是一个旧答案,今天可能有更好的方法来做到这一点。自 2011 年以来,现代 javascript 构建工具已经取得了长足的进步
。我今天实际上就是这样做的。
首先我考虑使用 sprockster,因为我喜欢定义脚本依赖项的 c/c++ include 风格。
我最终使用了 Apache ant,因为我的一些团队成员有点害怕 ruby。
Apache ant 似乎也是一个更通用且文档齐全的工具。
我还没有弄清楚如何自动构建 sass 文件,但这应该不会太困难。
我使用的过程很简单:
这就是我最终得到的结果:
如您所见,我指定了项目中的每个文件。这只是为了得到正确的顺序。如果您的代码写得比我的好,并且没有任何依赖项,您可以只包含整个源文件夹。
EDIT: Warning: this is an old answer, today there might be better ways to do this. Modern build tools for javascript have come a long way since 2011.
I actually did just this today.
First I considered using sprockster, since I liked the c/c++ include style of defining script dependencies.
I ended up using Apache ant because some of my team members are somewhat afraid of ruby.
Apache ant also seemed like a more universal and well documented tool.
I haven't figured out how to build the sass files automatically just yet, but that shouldn't be too difficult.
The process i use is kind of simple:
This is what i ended up with:
As you can see, I specify every single file in my project. This is just to get the order right. If your code is better written than mine, and don't have any dependencies, you could just include an entire source folder.