Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

snowpack-plugin-imagemin

jaredLunde3MIT1.0.0TypeScript support: included

Use imagemin to optimize your images in Snowpack

snowpack plugin imagemin, snowpack plugin, imagemin

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

Build status NPM Version MIT License


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

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.0.0 (2020-08-11)