gulpImage lossless compression (with gulp-imagemin)


Syntax

  1. imagemin([plugins], {options})

Parameters

ArgumentDescription
sourcePathImages' source directory (for example: /assets/images)
buildPathDestination path (for example: /static/dist/)

Remarks

First argument to imagemin constructor is plugin array. By default, following plugins are used: [imagemin.gifsicle(), imagemin.jpegtran(), imagemin.optipng(), imagemin.svgo()]

Second argument are options. In the above example following options are used:

{
  progressive: true,
  interlaced: true,
  svgoPlugins: [{removeUnknownsAndDefaults: false}, {cleanupIDs: false}]
}

Those are completely optional.

progressive is used by imagemin-jpegtran.

interlaced is used by imagemin-gifsicle.

removeUnknownsAndDefaults and cleanupIDs are used by imagemin-svgo.