-
Notifications
You must be signed in to change notification settings - Fork 10.3k
docs(gatsby-plugin-image): Add image plugin toolkit docs #29483
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
Conversation
gillkyle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good 🙂
I left a few suggestions that you're welcome to consider. I think a section at the end that links to places where this is implemented in other source plugins would be really helpful too.
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| // You could also calculate dominant color, and pass that as `backgroundColor` | ||
| // gatsby-plugin-sharp includes helpers that you can use to generate a tracedSVG or calculate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not exactly sure what these helpers are, maybe it could be possible to link to some docs/code (wherever it exists?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I need to document these!
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Kyle Gill <[email protected]>
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Frederick Fogerty <[email protected]>
laurieontech
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really great job! I understand the two paths a lot better now. Left small edits and comments.
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
| --- | ||
|
|
||
| The [new Gatsby image plugin](https://www.gatsbyjs.com/docs/how-to/images-and-media/using-gatsby-plugin-image) includes React components for displaying images, and these can be used with data from plugins. The plugin handles all of the hard parts of displaying responsive images that follow best practices for performance. In fact we are confident that it is the fastest way to render images in React, as it can handle blur-up and lazy-loading before React hydration. | ||
| Support for these are available out of the box in `gatsby-transformer-sharp`, so if your plugin downloads images and processes them locally then your users can use the [`gatsbyImageData` resolver](https://www.gatsbyjs.com/docs/how-to/images-and-media/using-gatsby-plugin-image#dynamic-images). However, if your CDN can deliver images of multiple sizes with a URL-based API, then the plugin includes a toolkit to allow you to give your users the same great experience without needing to download the images locally. It also allows you to create components that display these images dynamically at runtime, without needing to add a GraphQL resolver. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these components?
|
|
||
| There are three steps to add a basic `gatsbyImageData` resolver: | ||
|
|
||
| 1. [Create the `generateImageSource` function](#create-the-generateimagesource-function) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might put this earlier to help give context? Not sold on that approach though.
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
docs/docs/how-to/plugins-and-themes/adding-gatsby-image-support.md
Outdated
Show resolved
Hide resolved
Co-authored-by: LB <[email protected]>
laurieontech
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is certainly ready to go in. Any smaller changes can be made later.
WIP: docs for plugin authors
rendered view