项目作者: jaredLunde

项目描述 :
Use @imagemin to optimize your images in Snowpack
高级语言: TypeScript
项目地址: git://github.com/jaredLunde/snowpack-plugin-imagemin.git
创建时间: 2020-08-11T02:55:27Z
项目社区:https://github.com/jaredLunde/snowpack-plugin-imagemin

开源协议:MIT License

下载



snowpack-plugin-imagemin

Use imagemin to optimize your images in Snowpack. This plugin will only compress
images in production after your build finishes.

  1. npm i snowpack-plugin-imagemin




Build status


NPM Version


MIT License


Quick start

  1. // snowpack.config.js
  2. module.exports = {
  3. plugins: [
  4. [
  5. 'snowpack-plugin-imagemin',
  6. {
  7. /* see "Plugin Options" below */
  8. include: ['**/*.jpg', '**/*.png'],
  9. plugins: [
  10. require('imagemin-mozjpeg')({quality: 90, progressive: true}),
  11. require('imagemin-optipng')({optimizationLevel: 7}),
  12. ],
  13. },
  14. ],
  15. ],
  16. }

Plugin Options

  1. export interface SnowpackPluginImageminOptions {
  2. /**
  3. * Includes only the specified globs. Globs should be relative
  4. * to the build directory, which is `build/` by default in Snowpack.
  5. * *
  6. * ! This option is required !
  7. */
  8. include: Parameters<typeof imagemin>[0]
  9. /**
  10. * Plugins to use.
  11. * @see https://www.npmjs.com/search?q=keywords:imageminplugin
  12. *
  13. * ! This option is required !
  14. */
  15. plugins: imagemin.Options['plugins']
  16. }

LICENSE

MIT