Rails 如何 Gzip Javascript?(Heroku) [英] Rails how to Gzip Javascript? (Heroku)
问题描述
我已经运行了 google 页面速度,它说我应该 Gzip 我的 javascript 文件?
I have run google page speed and it is saying that I should Gzip my javascript files?
如何压缩我的 javascript 文件?如果有问题,我的网站托管在 heroku 上
How do I gzip my javascript files? My website is hosted on heroku if that mattter
推荐答案
此答案已过时,但我无法删除它,因为它已被接受.所以我把它变成了一个社区维基,这样人们就可以修复它.
This answer is out of date but I can't delete it because it was accepted. So I'm turning it into a community wiki so that people can fix it up.
Heroku 应该自动压缩所有内容(当然,只要客户端支持它).来自旧博文:
Heroku should be gzipping everything automatically (as long as the client supports it of course). From an old blog post:
部署到 Heroku 的所有应用程序都会自动压缩它们所服务的页面,这在输出过程中会通过 Nginx 的 gzip 过滤器.
All apps deployed to Heroku automatically compress pages they serve, by virtue of passing through Nginx’s gzip filter on the way out.
来自当前文档:
在 heroku.com HTTP 堆栈上,请求通过处理 SSL 和 Gzip 的 Nginx 进入平台.
On the heroku.com HTTP stack, requests enter the platform through Nginx, which handles SSL and Gzip.
这篇关于Rails 如何 Gzip Javascript?(Heroku)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!