How to Use imageoptim in Middleman
Using imageoptim in middleman isn’t very straightforward on ubuntu. Here is how I did it.
Install and Prepare the imageoptim Middleman Extension
-
Update ruby and install
middleman-imageoptim
gem update gem install middleman-imageoptim
-
Add
imageoptim
toconfig.rb
configure :build do activate :imageoptim end
-
Add
imageoptim
toGemfile
gem "middleman-imageoptim"
Install and Prepare the image_optim ruby gem
-
install
image_optim
gem install image_optim
-
Install dependencies
sudo apt-get install -y advancecomp gifsicle jhead jpegoptim libjpeg-progs optipng pngcrush pngquant
-
Install
pngout
-
Download the static linux binary from here. (I observed no real difference between the static vs. non-static)
-
Extract it
-
Open the
x86_64
folder -
rename the file to
pngout
-
Open a terminal at that location and run
sudo cp pngout /usr/bin
-
Now it should work! The optimization may take a while if you have a lot of images.
Published: 2014-09-25