Serving big images is for numb-skulls! Compress and optimise your imagery during middleman build
by running image_optim over it. Aww yiss!
Go set up the image_optim external utilities, then;
gem "middleman-imageoptim", "~> 0.1.3"
activate :imageoptim
You can also configure the extension in the usual fashion, by passing a block to :activate
Below is the default configuration showing all available options;
activate :imageoptim do |options|
# print out skipped images
options.verbose = false
# Setting these to true or nil will let options determine them (recommended)
options.nice = true
options.threads = true
# Image extensions to attempt to compress
options.image_extensions = %w(.png .jpg .gif)
# compressor worker options, individual optimisers can be disabled by passing
# false instead of a hash
options.pngcrush_options = {:chunks => ['alla'], :fix => false, :brute => false}
options.pngout_options = {:copy_chunks => false, :strategy => 0}
options.optipng_options = {:level => 6, :interlace => false}
options.advpng_options = {:level => 4}
options.jpegoptim_options = {:strip => ['all'], :max_quality => 100}
options.jpegtran_options = {:copy_chunks => false, :progressive => true, :jpegrescan => true}
options.gifsicle_options = {:interlace => false}
end
- fix missing license in gemspec
- minor bugfix
- remove legacy requirement for padrino
- complete refactor and clean-up
- introduced an options class. options now work (lol, yay!), thanks @andrew-aladev for your help there
- change of extension activation name from
:image_optim
to:imageoptim
for consistency with internal naming