@eklingen/vinyl-stream-imagemin

2.0.1 • Public • Published

Small vinyl-stream wrapper -aka Gulp plugin- for imagemin

Run imagemin within your streams. Lazy loads plugins. This comes with quite a few subdependencies to download or compile the binaries. If "just optimize .png, .jpg and .svg" is good enough, take a look at "@eklingen/vinyl-stream-optimize-images". That one comes with batteries included.

NOTE: No tests have been written yet!

Installation

yarn install. Or npm install. Or just copy the files to your own project.

Usage

const imageminWrapper = require('@eklingen/vinyl-stream-imagemin')
stream.pipe(imageminWrapper())

Options

There are a few options you can play with:

plugins

What plugins you intend to use. Possible options are jpegoptim, optipng and svgo. You can pass either true or a configuration object.

imageminWrapper({
  plugins: {
    jpegoptim: true,
    optipng: true,
    svgo: true
  }
})
imageminWrapper({
  plugins: {
    jpegoptim: { ... },
    optipng: { ... },
    svgo: { ... }
  }
})

swallowUnchanged

Set this to true if you want the plugin to emit only changed files back into the stream.

imageminWrapper({
  swallowUnchanged: true
})

Dependencies

This package requires "imagemin".

Optional dependencies

This package can require "imagemin-jpegoptim", "imagemin-optipng" and "imagemin-svgo".


Copyright (c) 2019 Elco Klingen. MIT License.

Package Sidebar

Install

npm i @eklingen/vinyl-stream-imagemin

Weekly Downloads

1

Version

2.0.1

License

MIT

Unpacked Size

6.22 kB

Total Files

6

Last publish

Collaborators

  • eklingen