snowpack-plugin-imagemin
v1.0.0
Published
Use imagemin to optimize your images in Snowpack
Downloads
6
Maintainers
Readme
snowpack-plugin-imagemin
Use imagemin to optimize your images in Snowpack. This plugin will only compress images in "production" after your build finishes.
npm i snowpack-plugin-imagemin
Quick start
// snowpack.config.js
module.exports = {
plugins: [
[
'snowpack-plugin-imagemin',
{
/* see "Plugin Options" below */
include: ['**/*.jpg', '**/*.png'],
plugins: [
require('imagemin-mozjpeg')({quality: 90, progressive: true}),
require('imagemin-optipng')({optimizationLevel: 7}),
],
},
],
],
}
Plugin Options
export interface SnowpackPluginImageminOptions {
/**
* Includes only the specified globs. Globs should be relative
* to the build directory, which is `build/` by default in Snowpack.
* *
* ! This option is required !
*/
include: Parameters<typeof imagemin>[0]
/**
* Plugins to use.
* @see https://www.npmjs.com/search?q=keywords:imageminplugin
*
* ! This option is required !
*/
plugins: imagemin.Options['plugins']
}
LICENSE
MIT