我应该在 Rails 中使用 Sprockets 吗?

Should I use Sprockets in Rails?

当我通过 sublime 和 sftp 在 vps 上测试我的应用程序时,这些 Sprockets 缓存文件总是需要永远(比喻)同步。禁用 Asset Pipeline 的后果是什么?我的应用程序的性能会很差吗?

What are the consequences of disabling Asset Pipeline? Will my app perform noticeably poorly?

是的,资产管道存在是有原因的,引用 guide:

The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages and pre-processors such as CoffeeScript, Sass and ERB.

资产的串联导致更少的 HTTP 请求(连接设置),至少对于 HTTP 1.1 而言,这被认为是最佳实践。我想缩小不言而喻。查看指南以全面了解后果。

我不确定您对 sprocket 缓存文件的确切含义以及您在 VPS.

上使用的环境(如 Rails.env

您还可以在 VPS 上编译资产,这可能比上传更快。 (请参阅指南中的 compile/precompile 部分)。

出于测试目的,您还可以 运行 在 development 环境中,资产将在该环境中按需编译。