Skip to content
forked from imagemin/imagemin

Minify images seamlessly using commonjs modules

License

Notifications You must be signed in to change notification settings

Kabaril/imagemin

 
 

Repository files navigation

imagemin

Minify images seamlessly using commonjs modules


Warning

This repo is only for development purposes and not intended to be used in production enviroments.

Usage

const imagemin = require('imagemin');
const imageminSvgo = require('imagemin-svgo');

const files = await imagemin(['images/*.{svg}'], {
	destination: 'build/images',
	plugins: [
		imageminSvgo(),
	]
});

API

imagemin(input, options?)

Returns Promise<object[]> in the format {data: Buffer, sourcePath: string, destinationPath: string}.

input

Type: string[]

File paths or glob patterns.

options

Type: object

destination

Type: string

Set the destination folder to where your files will be written. If no destination is specified, no files will be written.

glob

Type: boolean
Default: true

Enable globbing when matching file paths.

imagemin.buffer(buffer, options?)

Returns Promise<Buffer>.

buffer

Type: Buffer

Buffer to optimize.

options

Type: object

plugins

Type: Array

Plugins to use.

Related

About

Minify images seamlessly using commonjs modules

Resources

License

Stars

Watchers

Forks

Languages

  • JavaScript 100.0%