缩小已修补的 javascript 文件

发布于 2024-08-06 14:47:35 字数 549 浏览 3 评论 0原文

我正在编写一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

罪#恶を代价 2024-08-13 14:47:35

您可以将插件配置为不触及补丁文件吗?

另外,请记住,在使用 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)

迷鸟归林 2024-08-13 14:47:35

与 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文