加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 如何压缩从运行在apache / passenger上的rails

发布时间:2020-12-17 03:12:53 所属栏目:百科 来源:网络整理
导读:我正在使用Apache 2.2,Passenger 3.0.2,Rails 3. 我已经设法通过修改deflate.conf文件来压缩css文件.但是,当我运行firefox addon yslow时,它仍然说javascript文件是未压缩的. IfModule mod_deflate.c AddOutputFilterByType DEFLATE text/html text/plain te
我正在使用Apache 2.2,Passenger 3.0.2,Rails 3.

我已经设法通过修改deflate.conf文件来压缩css文件.但是,当我运行firefox addon yslow时,它仍然说javascript文件是未压缩的.

<IfModule mod_deflate.c>
          AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript text/javascript application/x-javascript
</IfModule>

上面,我使用了所有三种变体:“application / javascript text / javascript application / x-javascript”但没有运气.

这是来自yslow的消息:

Grade D on Compress components with
gzip

There are 3 plain text components that
should be sent compressed

06001

解决方法

Jammit是Rails的工业级资产打包库,提供您期望的CSS和JavaScript连接和压缩,以及YUI Compressor和Closure Compiler兼容性,提前gzipping,内置JavaScript模板支持,和可选的Data-URI / MHTML图像和字体嵌入.

http://documentcloud.github.com/jammit/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读