Socket
Socket
Sign inDemoInstall

webp-loader

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webp-loader

WebP image loader & converter for Webpack


Version published
Weekly downloads
11K
decreased by-62.47%
Maintainers
1
Weekly downloads
 
Created
Source

webp-loader

Build Status

WebP image loader & converter loader for Webpack.

Install

npm install 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',
      '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',
      'webp?{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?{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

MIT

Keywords

FAQs

Package last updated on 09 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc