gulp Image lossless compression (with gulp-imagemin)

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9


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


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


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.

Got any gulp Question?