1.0.6 • Published 2 years ago

imagemin-sharp v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 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

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago