From fbb6fbe0d147b118aded70c60c2f66bd8117a017 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Thu, 12 Aug 2021 17:52:03 +0200 Subject: [PATCH] Readme fixes --- readme.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index b519cc1..a3d224a 100644 --- a/readme.md +++ b/readme.md @@ -28,12 +28,14 @@ export default () => ( ### Custom plugin options ```js +import imagemin, {gifsicle, mozjpeg, optipng, svgo} from 'gulp-imagemin'; + // … .pipe(imagemin([ - imagemin.gifsicle({interlaced: true}), - imagemin.mozjpeg({quality: 75, progressive: true}), - imagemin.optipng({optimizationLevel: 5}), - imagemin.svgo({ + gifsicle({interlaced: true}), + mozjpeg({quality: 75, progressive: true}), + optipng({optimizationLevel: 5}), + svgo({ plugins: [ {removeViewBox: true}, {cleanupIDs: false} @@ -46,9 +48,11 @@ export default () => ( ### Custom plugin options and custom `gulp-imagemin` options ```js +import imagemin, {svgo} from 'gulp-imagemin'; + // … .pipe(imagemin([ - imagemin.svgo({ + svgo({ plugins: [ { removeViewBox: true @@ -79,7 +83,7 @@ Unsupported files are ignored. #### plugins Type: `Array`\ -Default: `[imagemin.gifsicle(), imagemin.mozjpeg(), imagemin.optipng(), imagemin.svgo()]` +Default: `[gifsicle(), mozjpeg(), optipng(), svgo()]` [Plugins](https://www.npmjs.com/browse/keyword/imageminplugin) to use. This will completely overwrite all the default plugins. So, if you want to use custom plugins and you need some of defaults too, then you should pass default plugins as well. Note that the default plugins come with good defaults and should be sufficient in most cases. See the individual plugins for supported options.