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-imageoptimgem update gem install middleman-imageoptim -
Add
imageoptimtoconfig.rbconfigure :build do activate :imageoptim end -
Add
imageoptimtoGemfilegem "middleman-imageoptim"
Install and Prepare the image_optim ruby gem
-
install
image_optimgem 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_64folder -
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