How to enable compression in Ruby on Rails?

后端 未结 3 689
眼角桃花
眼角桃花 2021-02-05 06:29

I posted a similar question here

Serving Compressed Assets in Heroku with Rack-Zippy

but decided to give up on that service, since I couldn\'t get it to work.

3条回答
  •  耶瑟儿~
    2021-02-05 07:03

    Enable compression

    Add it to config/application.rb:

    module YourApp
      class Application < Rails::Application
        config.middleware.use Rack::Deflater
      end
    end
    

    Source: http://robots.thoughtbot.com/content-compression-with-rack-deflater

提交回复
热议问题