Sprockets preprocessor to losslessly compress .png and .jpg images using pngcrush and jpegoptim.
Just add this gem to your Gemfile:
gem 'sprockets-image_compressor'
The gem ships with a Railtie which will automatically register the compressor preprocessors.
If the environment doesn't have pngcrush and/or jpegoptim installed, the gem will fall back on binaries packaged with the gem. Currently, only 32bit and 64bit linux binaries are included. Pull requests welcome for other architectures!
If you have other sprockets processors registered for images, e.g. sprockets-webp
, the relative order that they are required can matter. Please load sprockets-image_compressor
before the others:
gem 'sprockets-image_compressor'
gem 'sprockets-webp'
See #15 for more information.
- Provide configuration hooks
- Test Railtie
- @nhogle for help with compiling and packaging the jpegoptim and pngcrush binaries
- @JakeTheSnake3p0 for Windows support
- @florentmorin for compatibility with sprockets-rails
- @dkubb for compatibility with Rails 4
(MIT License) - Copyright (c) 2014 Micah Geisel