0.0.1 • Published 1 year ago

rollup-plugin-generate-icon v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

rollup-plugin-generate-icon

A rollup plugin to generate icons of different sizes

Images in the icons field and action.default_icon field in chrome extensions Manifest V3 can be generated using this plugin

Support

  • vite(build mode, build watch mode)

  • rollup

Usage

add the plugin:

npm install rollup-plugin-generate-icon --save-dev
// or
pnpm add rollup-plugin-generate-icon -D
// or
yarn add rollup-plugin-generate-icon -D

configure the plugin:

generateIcon({
    logo: path.resolve(__dirname, "./public/icon.png"),
    dir: "icons",
    size: [16, 32, 48, 64, 128], //or a number
    format: "png",
    grayscale: false,
    imgName: "icon",
}),

Configuration Settings

OptionRequiredTypeDefaultAbout
logoyesstringnoneimages that need to be converted
dirnostring"icons"the directory for the output picture
sizenonumber[]/number16, 32, 48, 64, 128image size, if it is a number, only one image is generated, if it is an array, it is multiple images
formatnokeyof sharp.FormatEnum"png"the format of the output picture
grayscalenobooleanfalsewhether to generate a gray image
imgNamenostring"icon"name of the picture

Acknowledgement

Inspired by plasmo's ability to generate images.

0.0.1

1 year ago