如何缩小aspx页面
我正在开发一个基于网络的口袋妖怪在线游戏。由于它是在线的,我想优化它以尽可能快地运行。
我已经安装了 Firebug,Page Speed 建议缩小我的 HTML 输出。我还使用 VS2008、ASP.NET 3.5、AJAX 和 IIS 7.5;与 URL 重写一起。
我想缩小我的 HTML、JavaScript 和 CSS。最理想的是,我希望缩小过程在编译时发生。我花了几个小时在网上查找但找不到合适的解决方案,你能帮助我吗?谢谢。
I am developing a web-based Pokemon Online game. Since it is online, I would like to optimize it to run as quickly possible.
I've installed Firebug and Page Speed suggests minifying my HTML output. I'm also using VS2008, ASP.NET 3.5, AJAX, and IIS 7.5; along with URL-Rewriting.
I want to minify my HTML, JavaScript, and CSS. Optimally, I'd like the minifying process to happen at compile time. I've spend hours looking online but couldn't find a decent solution, can you help me? Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先,您应该阅读雅虎加速网页的最佳实践。
您可能会发现缩小 HTML 不会有太大区别(另请参阅这个问题),但有很多区别该文章中的其他建议将会。
Firstly, you should read the Yahoo best practices for speeding up webpages.
You will probably find that minifying the HTML won't have much difference (also see this question), but a lot of the other suggestions in that article will.
有几种方法可以实现此目的。如果您有访问权限,可以使用 IIS7 配置 GZip 压缩。如果您不这样做,即您正在使用托管提供商,则可以从代码中激活压缩。
请参阅此SO 帖子以进一步阅读。
更新:
要在构建时而不是运行时执行此操作,请参阅此博客文章。
There are a couple of methods to achieve this. You can configure GZip compression with IIS7 if you have access. If you don't i.e. you are using a hosting provider it is possible to activate compression from within your code.
See this SO Post for further reading.
UPDATE:
To perform this at build time rather than run time see this blog post.
不要考虑缩小 .aspx 文件,而是考虑
动态压缩
。这会将压缩数据发送到浏览器。由于您使用的是内置的 IIS 7.5 动态压缩,因此您只需启用它即可。Instead of minifying your .aspx files consider
dynamic compression
. This will send compressed data to the browser. since you are using IIS 7.5 dynamic compression comes built-in you just have to enable it.