Image optimization for Grunt using imgo
Installation
This plugin requires Grunt 0.4.
Install imgo (see How to install imgo on OS X below for instructions).
npm install grunt-imgo --save-dev
Add to your Gruntfile.js
:
grunt;
Then add section named imgo
inside grunt.initConfig()
. See next section for details.
Parameters
string|array
src Images list: PNG, GIF or JPEG. String or array. Wildcards are supported.
string
dest Destination path for images copying before optimizing.
icons:src: 'static/dev/img/*.*'dest: 'static/build/img/'
string
options Any options you want to pass to imgo
.
icons:src: 'icons/*.png'options: '-m -b'
boolean
skip If true
task will not be ran. In example, you can skip imgo
on Windows (becase of difficult installation):
skip: platform === 'win32'
Gruntfile Example
module {grunt;grunt;grunt;};
imgo
on OS X
How to install Install Homebrew.
Run following commands in terminal:
brew install exiftool imagemagick optipng libjpeg gifsicle formulas='pngout.rb defluff.rb cryopng.rb imgo.rb'
You may need to use sudo
for brew
, depending on your setup.
Release History
2013-06-18 v0.1.1
dest
option (by @smolnikov).- Fix
options
: cannot parse several keys. - Verbose output of
imgo
command.
2013-02-18 v0.1.0
- Grunt 0.4 support.
- file option renamed to src.
License
The MIT License, see the included License.md
file.