缩小已修补的 javascript 文件
我正在编写一个 Rails 应用程序,并且已将这个漂亮的小补丁部分集成到内联 ajax 编辑器中: http: //inplacericheditor.box.re/
问题是,在该页面上我包含了tinymce、prototype 和scriptaculous。至少在 Firefox 中,加载所有这些内容时会出现很大的延迟。我希望通过压缩文件来修复它,所以我检查了一个名为 Smurf 的 Rails 插件。它似乎很好地完成了它应该做的事情,但是它被 Ajax 编辑器中包含的小补丁文件所困扰。补丁文件看起来像这样:
Object.extend(Ajax.InPlaceEditor.prototype, {
handleAJAXFailure: function(transport)
或者,我应该只捕获它们而不是担心它们被压缩吗?我知道我正在开发中,Apache 可能会以不同的方式处理 js 文件的服务。看起来好像在一个页面上需要提供很多东西。
I'm writing a Rails app and I've partially integrated in this nice little patch to the in line ajax editor: http://inplacericheditor.box.re/
The problem is, on that page I have tinymce, prototype and scriptaculous included. In Firefox at least there's a big lag when all this stuff is loading. I was hoping to fix it by compressing the files so I checked out a plugin for rails called Smurf. It seemed to do what it was supposed to do nicely, but it choked on the little patch files that are included with the Ajax editor thing. THe patch files look like this:
Object.extend(Ajax.InPlaceEditor.prototype, {
handleAJAXFailure: function(transport)
Alternatively, should I just be catching them instead of worrying about minfying them? I know I'm running on development and that Apache would maybe be handling serving the js files differently..It just seems like a lot of things to serve on one page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将插件配置为不触及补丁文件吗?
另外,请记住,在使用
mod_deflate
发送文件之前让 Apache 对文件进行 gzip 压缩有很大帮助 - 通常可以节省 50% 左右。 (需要引用)Can you configure your plugin to not touch the patch files?
Also, remember that getting Apache to gzip the files prior to sending them with
mod_deflate
helps a LOT - saving usually 50% or so. (Citation needed)与 gzip + 适当的缓存策略相比,缩小并没有带来太大的改进。
资源缓存已内置于 Rails 中,因此您需要将其打开。 Gzip 可以在您的服务器配置中设置。
Minification doesn't bring much improvement over gzip + proper caching strategy.
Assets caching is already built into Rails, so you would need to turn that on. Gzip can be set up in your server configuration.