Nomenclature Predictably Misunderstood

    webp-loader-next

    0.7.5 • Public • Published

    webp-loader-next

    WebP image loader & converter loader for Webpack.

    Install

    npm install webp-loader-next --save-dev

    Usage

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

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

    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-loader-next?{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 the option emitBeforeFile to achieve it:

    loaders: [
      {
        test: /\.(jpe?g|png)$/i,
        loader: 'file-loader?name=[name].[ext].webp!webp-loader-next?{quality:95,emitBeforeFile:"[name].[ext]"}'
      },
    ]

    Options

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

    Inspiration

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

    License

    MIT

    Install

    npm i webp-loader-next

    DownloadsWeekly Downloads

    43

    Version

    0.7.5

    License

    MIT

    Unpacked Size

    9.02 kB

    Total Files

    12

    Last publish

    Collaborators

    • tofandel