webpack-wepb-converter
Description
Converting background images in css to webp with fallback for not support browsers
Usage
//webpack.config.jsconst webpackWepbConverter= ; moduleexports = configureWebpack: plugins: config: test: /\./ options: quality: 100 lossless: true test: /\./ options: quality: 90 nearLossless: 40 sns: 100
Custom options in css
bg-options
is additional css properties for individual converting image. It overwrite default options from webpack config.
Available options:
Name | Value |
---|---|
preset | default, photo, picture, drawing, icon, text |
quality | int |
alphaQuality | int |
m | int |
size | int |
sns | int |
filter | int |
f | int |
autoFilter | boolean |
sharpness | int, 0 to 7 |
lossles | boolean |
nearLossless | int |
ignore | boolean |
most of int between 0 and 100
ignore
skip convert this image
read more https://developers.google.com/speed/webp/docs/cwebp
Bugs
- media queries not processing yet
- options of same images whith different bg-options in different css selectors may not applay