Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.9K
decreased by-51.42%
Maintainers
1
Weekly downloads
 
Created
Source

webp-loader

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?hash=sha512&digest=hex&name=[hash].[ext]',
      'webp'
    ]
  }
]

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?hash=sha512&digest=hex&name=[hash].[ext]',
      '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?hash=sha512&digest=hex&name=[hash].[ext]',
      'file?hash=sha512&digest=hex&name=[hash].[ext].webp!webp?{quality: 75}'
    )
  },
]

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 (http://www.opensource.org/licenses/mit-license.php)

Keywords

FAQs

Package last updated on 08 Jan 2016

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