Minify images seamlessly using commonjs modules
This repo is only for development purposes and not intended to be used in production enviroments.
const imagemin = require('imagemin');
const imageminSvgo = require('imagemin-svgo');
const files = await imagemin(['images/*.{svg}'], {
destination: 'build/images',
plugins: [
imageminSvgo(),
]
});
Returns Promise<object[]>
in the format {data: Buffer, sourcePath: string, destinationPath: string}
.
Type: string[]
File paths or glob patterns.
Type: object
Type: string
Set the destination folder to where your files will be written. If no destination is specified, no files will be written.
Type: boolean
Default: true
Enable globbing when matching file paths.
Returns Promise<Buffer>
.
Type: Buffer
Buffer to optimize.
Type: object
Type: Array
Plugins to use.
- imagemin - Original Repository
- imagemin-cli - CLI for this module
- imagemin-app - GUI app for this module
- gulp-imagemin - Gulp plugin
- grunt-contrib-imagemin - Grunt plugin