Middleman ImageOptim Extension
Wat.
Serving big images is fo numb-skulls! Compress and optimise your imagery during middleman build
by running image_optim over it. Yay-hooray!
Installation
Go set up the image_optim external utilities, then;
gem "middleman-imageoptim", "~> 0.1.0"
Usage
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 ||
# print out skipped images
.verbose = false
# Setting these to true or nil will let options determine them (recommended)
.nice = true
.threads = true
# Image extensions to attempt to compress
.image_extensions = %w(.png .jpg .gif)
# compressor worker options, individual optimisers can be disabled by passing
# false instead of a hash
. = {:chunks => ['alla'], :fix => false, :brute => false}
. = {:copy_chunks => false, :strategy => 0}
. = {:level => 6, :interlace => false}
. = {:level => 4}
. = {:strip => ['all'], :max_quality => 100}
. = {:copy_chunks => false, :progressive => true, :jpegrescan => true}
. = {:interlace => false}
end
Changelog
0.1.0
- 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