You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently moving a plain HTML website to Gatsby and I wonder how I should move responsive images that use multiple scales (@1x, @2x, @3x, @4x) to use the <Img /> component.
I'm aware of the different query variables such as width or maxWidth and the fluid vs fixed types, however should I just serve the @4x image and expect Gatsby to do the heavy lifting for me ? Not sure how the sizes attribute could be translated neither.
Take your @4x images, query them by GraphQL (with fluid and the right maxWidth & quality setting), pass that to your <Img fluid={your.query.fluid} /> (gatsby-image) and it handles everything for you.
Summary
I'm currently moving a plain HTML website to Gatsby and I wonder how I should move responsive images that use multiple scales (
@1x
,@2x
,@3x
,@4x
) to use the<Img />
component.Explanation
The images currently look like this:
I'm aware of the different query variables such as
width
ormaxWidth
and thefluid
vsfixed
types, however should I just serve the@4x
image and expect Gatsby to do the heavy lifting for me ? Not sure how thesizes
attribute could be translated neither.On the docs it states
So I guess only serving the
@4x
image is fine, but what about thesizes
attribute ? I guess if I set the image type tofluid
it could handle it ?Thank you very much !
The text was updated successfully, but these errors were encountered: