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

Readme

Keywords

Package Sidebar

Install

npm i imagemin-sharp

Weekly Downloads

21

Version

1.0.6

License

MIT

Unpacked Size

30.8 kB

Total Files

8

Last publish

Collaborators

  • bougie