1.0.6 • Published 4 years ago

webp-converter-webpack-plugin v1.0.6

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

install

yarn add webp-converter-webpack-plugin

use

const WebpPlugin = require("webp-converter-webpack-plugin");

  plugins: [
   ...,
    new WebpPlugin({
      quality: 0.8,
      changeName: false,
      enabled: true,
      log: true,
      limit: 1024 * 32,
      imageReg: /\.(png|jpg|jpeg|webp)$/i
    }),
  ],
namedefaultdesc
quality0.8quality of webp, 0~1 or 0~100
changeNamefalsechange fileName name.jpg to name.webp. if you want to change ouput filenname you also need change url-loader config
enabledtrueenable this plugin
logtrueshow compress info log
limit1024 * 32Images size bigger than 32K will be compressed, default 32k
imageReg/\.(png|jpg|jpeg|webp)\$/iimage name regular expression

notice

if you use changeName, you need to config url-loader to change image name too.

{
  test: /\.(png|jpg|jpeg|ico|webp)$/i,
  use: {
    loader: "url-loader",
    options: { limit: 8192, name: "[hash].webp" },
  },
},

result

filenameraw sizewebp sizecompress ratio
cab72b5040f5cb047a86e251c5303fb4.webp12.47k5.91k47.37%
64fe31f5ec09e8a17860d24e7c04921d.webp10104.01k2286.62k22.63%
00ae1b36370fe4694f7cec16fea9d48c.webp5926.21k727.20k12.27%
1.0.6

4 years ago

1.0.5

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago