How do you handle responsive images and srcset without losing your mind?
Every time I set up srcset and sizes I have to look up the syntax again, and then I'm never sure the browser is picking the image I expect.
Do you generate variants at build time, use an image CDN, or just export a couple of sizes by hand? And how do you check which file actually got loaded?
Comments · 2
I let the framework or an image CDN generate srcset. Hand-writing it is how you end up with the wrong sizes attribute.
Remember the sizes attribute describes the slot width, not the screen. Once you think in slot widths it clicks.