Skip to content
This repository was archived by the owner on May 8, 2024. It is now read-only.
/ webp-loader Public archive
forked from kavu/webp-loader

WebP image loader & converter for Webpack

License

Notifications You must be signed in to change notification settings

mole-inc/webp-loader

This branch is 4 commits ahead of kavu/webp-loader:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a55e802 · Dec 4, 2021

History

49 Commits
Dec 4, 2021
Dec 4, 2021
Dec 4, 2021
Dec 4, 2021
Apr 26, 2020
Jun 1, 2019
Dec 4, 2021
Apr 26, 2020
Apr 26, 2020
Apr 26, 2020
Apr 26, 2020
Dec 4, 2021
Dec 4, 2021

Repository files navigation

webp-loader

WebP image loader & converter loader for Webpack.

Install

npm install @mole-inc/webp-loader --save-dev

Usage

Here is the example of using webp-loader along with common file-loader:

loaders: [
  {
    test: /\.(jpe?g|png)$/i,
    loaders: [
      'file-loader',
      '@mole-inc/webp-loader'
    ]
  }
]

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: [
      'file-loader',
      '@mole-inc/webp-loader?{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: multi(
      'file-loader?name=[name].[ext].webp!webp-loader?{quality: 95}'
      'file-loader?name=[name].[ext]',
    )
  },
]

Options

For all possible options please visit "API" section of the official imagemin-webp README.

Inspiration

webp-loader is heavily inspired by tcoopman/image-webpack-loader.

License

This is a fork of kavu/webp-loader.

see license file.

About

WebP image loader & converter for Webpack

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 91.5%
  • Shell 8.5%