减少从EXTJS应用下载的文件的大小/数量 [英] Reduce size/number of files being downloaded from EXTJS app

查看:110
本文介绍了减少从EXTJS应用下载的文件的大小/数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Sencha CMD来构建应用程序,并希望确保仅下载运行该应用程序所需的内容.我读过一些地方的方法,这是通过使用Required []子句仅包含必需的类,但是我认为我不太清楚这一点.例如,我的页面中包含{xtype:'grid'},但是我没有放置Requires:['Ext.grid.Panel'],但它仍可以正确显示.在我看来,如果我没有包含需求,而CMD正在执行我认为应做的事情,则该页面应该无法加载,因为未包含Ext.grid.Panel.它正在工作的事实使我认为CMD会自动为我包含它,但是它还能自动包含什么并可能使下载变得肿?如何确保仅下载运行该应用程序所需的内容?

I used Sencha CMD to build an app and want to ensure that I'm only downloading what is required for the app to run. I have read some places that the way to do this is by using the Required [] clause to only include the required classes, however I don't think I understand this clearly. For example I have a page that has an {xtype: 'grid'} within it, but I haven't put Requires : [ 'Ext.grid.Panel' ], yet it still displays properly. In my mind if I haven't included the requires, and CMD is doing what I think it should, this page should fail to load because Ext.grid.Panel wasn't included. The fact that it's working is making me think that CMD is automatically including it for me, but what else is it automatically including and potentially bloating the download? How can I ensure that I'm only downloading what's required for the app to run?

推荐答案

我找到了问题的答案.我在使用该应用程序的服务器上开发应用程序,当我运行"sencha应用程序构建产品"时,它将所有构建"文件放入一个单独的目录中.我当时假设微型加载器/引导程序进程将在该目录中查找,但是我想那不是它的工作方式.然后,我必须将这些构建"文件复制到新目录,并将index.html和bootstrap.js包括在新目录中,然后它似乎可以工作,仅加载所需的文件.当然,尚不清楚这是否是必需的.希望这可以帮助其他遇到相同问题的人.

I found the answer to my problem. I was developing my app on the same server that I'm serving it from, and when I was running "sencha app build production", it's putting all of the "build" files into a separate directory. I was assuming the microloader/bootstrap process was then going to look in that directory but I guess that's not how it works. I had to then copy those "build" files to a new directory and include my index.html and bootstrap.js in the new directory and then it appears to work, only loading the required files. It's certainly not clear anywhere that this is what's required. Hopefully this will help anyone else having the same issue.

这篇关于减少从EXTJS应用下载的文件的大小/数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆