Created
October 27, 2013 22:05
-
-
Save dv/7188418 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Important to tell Sprockets this is a binary type, else you'll get UTF-8 byte sequence errors | |
Rails.application.assets.register_mime_type 'image/png', '.png' | |
Rails.application.assets.register_postprocessor 'image/png', :png_compressor do |context, data| | |
IO.popen("pngquant -", "rb+") do |process| | |
process.write(data) | |
process.close_write | |
process.read | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment