Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gatsbyImageData resolver #100

Closed
wants to merge 6 commits into from

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Jan 26, 2021

Hello!
This PR adds initial support for the beta Gatsby Image plugin. This plugin includes a new, higher-performance image component that gives better Lighthouse scores, and a simpler GraphQL API. See more information here. As part of the image plugin, we have added a toolkit to help add support to source plugins. I have used this to add basic support for the new resolver. See details here: gatsbyjs/gatsby#28241

The new plugin also now has support for runtime dynamic images with a new useGatsbyImage hook. You could create a SanityImage component that takes an image node and the image options as props, rather than through GraphQL. I'd love to work with you to show how this could be done.

For the moment, while the image plugin is in beta, we should not be documenting this as the preferred method, but by the time we go to GA next month we'd like to try and start moving starters and examples over to the new plugin. We have a codemod to help users with migration, and there is a possibility to add support for migrating Sanity sites too.

I'd love some feedback on this PR, and whether you like the approach I've taken.

@coreyward
Copy link

I like the approach mapping image fit modes to Gatsby Image fit/fill styles, but I believe this will need to wait to be merged until this bug gets fixed, otherwise the fit modes will get ignored entirely.

@johngrasty
Copy link

This might be rather helpful to move forward on given that gatsby@3 is out and along with it the official blessing of gatsby-plugin-image.

@RemusDutulescu
Copy link

Also waiting for this. The newly embraced gatsby-plugin-image's GatsbyImage doesn't play well with _raw Sanity image fields...

@bjoerge
Copy link
Member

bjoerge commented Mar 16, 2021

These commits were included in today's v7.0.0 release, which also added support for Gatsby v3. (Full changelog)

Thanks a lot @ascorbic! 🙌 💖

@bjoerge bjoerge closed this Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants