Notorious Preying Mantis

    snowpack-plugin-imagemin
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0 • Public • Published

    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

    Install

    npm i snowpack-plugin-imagemin

    DownloadsWeekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    17.5 kB

    Total Files

    13

    Last publish

    Collaborators

    • jaredlunde