Hey,
I’m currently looking into improving my website speed and noticed that I can’t change the sizes that are automatically generated for the srcset of gallery images. Especially on small mobile devices you waste a lot of bandwidth with the default values, that are used depending on your theme.
I looked into the code further and saw that this was hardbaked in gallery.js (node_modules/@tryghost/kg-default-cards/lib/cards/gallery.js)
if (img.getAttribute('srcset') && image.width >= 720) {
if (rows.length === 1 && row.length === 1 && image.width >= 1200) {
img.setAttribute('sizes', '(min-width: 1200px) 1200px');
} else {
img.setAttribute('sizes', '(min-width: 720px) 720px');
}
}
Why is there no option for theme designers to at least give an option to set those values in package.json, like with image_sizes?
Or am I overlooking something?
I’m tempted to edit the file to my needs, but I want to keep the easy of updating ghost, when you haven’t meddled with the source code. :/
I’m looking forward to your input.