Open w0whitaker opened 4 days ago
You're absolutely right, I can't find anything around this in the docs either. We actually have a comment in the code for it: https://github.com/11ty/eleventy-img/blob/792df26a5f26e56aa8823b37f1410fbfa859e628/src/generate-html.js#L85-L88
If you can write something that links either to the spec or MDN too and describes when someone needs to add the sizes attribute, it would be great!
When using the 'eleventyImageTransformPlugin' with multiple widths set, 11ty complains if 'sizes' is not also set in 'defaultAttributes', but this requirement is not mentioned in the docs.
For example:
generates this error:
Error: Missing `sizes` attribute on eleventy-img shortcode from:...
If only one width is set, everything is fine. Adding
sizes: "auto"
to thedefaultAttributes
block fixes the error.Happy to write something up if there isn't something I'm missing.