heroku-deflater
heroku-deflater copied to clipboard
leverage Rack::Deflater's capabilities
Since, I believe, rack 1.6, Rack::Deflater
has the ability to not compress images. Here's the PR: https://github.com/rack/rack/pull/457
So:
module YourApp
class Application < Rails::Application
config.middleware.use Rack::Deflater, include: Rack::Mime::MIME_TYPES.select{|k,v| v =~ /text|json|javascript/ }.values.uniq
end
end
Maybe this capability can be leveraged in heroku-deflater to simplify the code? (if requiring that rack version is acceptable)