Next Phenomenal Microbrewery
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    webpn-loaderpublic

    webp-loader

    WebP image loader & converter loader for Webpack.

    Install

    npm install webp-new-loader --save-dev

    Usage

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

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

    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',
          'webpn?{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?name=[name].[ext].webp!webpn?{quality: 95}'
          'file?name=[name].[ext]',
        )
      },
    ]

    Options

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

    Inspiration

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

    Inspiration

    webpn-loader is heavily inspired by webp-loader.

    License

    MIT

    install

    npm i webpn-loader

    Downloadsweekly downloads

    4

    version

    0.1.2

    license

    MIT

    homepage

    github.com

    repository

    githubgithub

    last publish

    collaborators

    • avatar