DEV Community

Discussion on: How to load responsive images in AVIF and WebP using the HTML picture element

Collapse
 
pavelloz profile image
Paweł Kowalski • Edited

Hey Salma, great article (i just learned about decoding="async"). Do you dynamically create avif version when it is requested or pregenerate them?

Collapse
 
whitep4nth3r profile image
Salma Alam-Naylor • Edited

Thank you Paweł! It all depends on the browser support. So on page load, the browser will decide which image URLs to request to load. Those AVIF images are requested, when supported, technically dynamically via the URL params on the Contentful URL. There’s probably some caching on Contentful’s side, so they probably aren’t generated from scratch every single time they are requested.