zouhir / lqip-loader

Low Quality Image Placeholders (LQIP) for Webpack
1.21k stars 44 forks source link

Use loader only for large images #14

Open wlingke opened 6 years ago

wlingke commented 6 years ago

Is there a way to only use this loader for large images? Similar to url-loader's limit option. I probably don't want to use this for the images that are already small :)

wlingke commented 6 years ago

To be a bit more specific, if I have this configuration for the loaders:

const imageLoaders = [
  {
    loader: 'lqip-loader',
    options: {
      path: '/lqip',
      name: '[name]_[hash].[ext]',
      base64: true,
    },
  },
  {
    loader: 'url-loader',
    options: {
      name: '[name]_[hash].[ext]',
      limit: 5000,
    },
  },
]

For small images <5000B, I'd be loading both a LQIP version and a full version into base64 right?

zouhir commented 6 years ago

very smart idea but not possible at the moment. I would like to add it.