Setup the ImageOptimize plugin with Craft CMS
My install and configuration notes.
To start install the plugin from the Craft CMS plugin store. That will download, install and update your composer.json file.
Install Image Processors & Variant Creators
I used brew to install jpegoptim
, optipng
, cwebp
and npm
to install svgo
brew install jpegoptim
brew install optipng
brew install cwebp
brew install gifsicle
npm install -g svgo
All of this can be done in one or two commands, but I prefer going slow and installed each processor one at a time.
Update paths in config file
Copy file vendor/nystudio107/craft-imageoptimize/src/config.php
to my config folder and rename it image-optimize.php
Get paths by using following commands and copy and paste path into your custom image-optimize.php
file
which jpegoptim
path is/usr/local/bin/jpegoptim
which optipng
path is/usr/local/bin/optipng
which cwebp
path is/usr/local/bin/cwebp
which gifsicle
path is/usr/local/bin/gifsicle
which svgo
path is/Users/scottgruber/.nvm/versions/node/v12.8.0/bin/svgo