1.0.6 • Published 3 years ago

imagemin-sharp v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago