towebp-loader

0.0.4 • Public • Published

webp-loader

WebP image loader & converter loader for Webpack. 功能:可以保留源文件,并且使用源文件的hash命名

Install

npm install toWebp-loader --save-dev

Usage

Here is the example of using toWebp-loader along with common mime:

loaders: [
  {
    test: /\.(jpe?g|png)$/i,
    loaders: [
      'toWebp'
    ]
  }
]

Unfortunately, if you wish to pass an options for internal imagemin-webp you should pass a options in JSON form:

loaders: [
  {
    test: /\.(jpe?g|png)$/i,
    loaders: [
      'toWebp?{quality: 13}'
    ]
  }
]

Normally you don't want to convert all of your images to WebP format, you just want to make alternate versions. You can use multi-loader to achieve it:

loaders: [
  {
    test: /\.(jpe?g|png)$/i,
    loader: ['toWebp?{quality: 95}']
  },
]

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i towebp-loader

Weekly Downloads

1

Version

0.0.4

License

MIT

Last publish

Collaborators

  • iceyan