imagemin-sharp

1.0.6 • Public • Published

imagemin-sharp

Imagemin plugin for sharp

Installation

npm install imagemin-sharp --save

Usage

import imagemin from "imagemin";
import imageminSharp from "imagemin-sharp";

const files = await imagemin(["images/*.{jpg,png}"], {
  destination: "build/images",
  plugins: [
    imageminSharp({
      chainSharp: async (sharp) => {
        const meta = await sharp.metadata();
        if (meta.width > 1000) {
          return sharp.flip().resize({ width: 1000 });
        }
        return sharp.flip();
      },
    }),
  ],
});

console.log(files);

Options

Options is a union of chainSharp and SharpOptions

Related

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.621latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.621
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i imagemin-sharp

Weekly Downloads

19

Version

1.0.6

License

MIT

Unpacked Size

30.8 kB

Total Files

8

Last publish

Collaborators

  • bougie