Open avstudnitz opened 3 years ago
Seems JPG fallback support will be tricky then...
No, they are not supported. It is tricky anyway. The picture
element is the main trick as of yet. I have been working myself on a non-Magento site with a PHP script that generates a base64-encoded string for the image and then uses a cookie to switch in between, but this is not ideal either. With Full Page Caching in mind, the solution either requires JavaScript and some cookie-magic (ugly), or a solution like picture
...
There might be a native solution for that in the future: see https://raoulkramer.de/avif-webp-images-css-background-usage-progressive-enhanced-with-image-set/.
Hmm, that's still a loooong wait :(
Just to be sure: background images are not supported, right? We are using code like this in custom widgets:
We might implement it if it doesn't exist already.