{"action":"opened","issue":{"number":14,"created_at":"2011-10-23T23:15:07Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"I've written a monkeypatch for `AssetSync::Storage#upload_file` that automagically replaces assets with gzipped versions. You may want to consider implementing its functionality (although perhaps in a user-configurable manner).\r\n\r\n```ruby\r\n# automagically compress assets\r\nif defined?(AssetSync)\r\n  gem 'asset_sync', '= 0.1.8' # die early if asset_sync may have changed\r\n\r\n  class AssetSync::Storage\r\n    def upload_file(f)\r\n      STDERR.puts \"Uploading: #{f}\"\r\n\r\n      gzip = File.exist?(\"#{path}/#{f}.gz\") # enable gzip compression if a gz asset exists\r\n      name = gzip ? f + '.gz' : f # use the gzipped asset's contents\r\n      mime = Mime::Type.lookup_by_extension File.extname(f)[1..-1] # detect MIME type\r\n\r\n      file = bucket.files.create(\r\n        :key              => \"#{f}\",\r\n        :body             => File.open(\"#{path}/#{name}\"),\r\n        :public           => true,\r\n        :cache_control    => \"max-age=31557600\",\r\n        :content_type     => mime, # explicitly provide content-type for assets AWS isn't aware of\r\n        :content_encoding => gzip ? 'gzip' : nil # gzipped-assets require Content-Encoding header\r\n      )\r\n    end\r\n  end\r\nend\r\n```","comments":0,"title":"Automagic asset compression","updated_at":"2011-10-23T23:15:07Z","url":"https://api.github.com/repos/rumblelabs/asset_sync/issues/14","id":2029173,"assignee":null,"milestone":null,"closed_at":null,"user":{"gravatar_id":"9ff064364151151cbce108b869e6e62d","avatar_url":"https://secure.gravatar.com/avatar/9ff064364151151cbce108b869e6e62d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/stouset","id":4338,"login":"stouset"},"html_url":"https://github.com/rumblelabs/asset_sync/issues/14","labels":[],"state":"open"},"legacy":{"number":14,"action":"opened","issue":2029173}}