Forum
srcset support
Have you ever considered built in srcset
support in Perch? At the moment, my templates are looking like this:
<img
sizes="(min-width: 64em) 33.33vw, (min-width: 40em) 50vw, 100vw"
srcset="
<perch:content type="image" id="image" label="Photo" width="200" height="133" crop="true" /> 200w,
<perch:content type="image" id="image" width="400" height="266" crop="true" /> 400w,
<perch:content type="image" id="image" width="600" height="396" crop="true" /> 600w"
/>
I'm wondering if there would one day be a way to implement srcset
so as to not repeat all those perch tags? I guess this would be more relevant with image processing on the fly.
I was thinking perhaps there could be something like this:
<img
sizes="(min-width: 64em) 33.33vw, (min-width: 40em) 50vw, 100vw"
srcset="<perch:content type="srcset" id="image" widths="200,400,600" />">
Just a thought! :)
I don't see any reason you couldn't build that as a field type.
https://docs.grabaperch.com/api/field-types/