-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Should gatsby-image
be added to the default starter?
#9158
Comments
Probably easier although there's a whole example page dedicated to gatsby-image / image-processing. You'd add a bunch of plugins, too.
gatsby-image shouldn't be used every time in my opinion. It shouldn't replace the img tag and I think this would imply exactly that.
Can you use gatsby-image with SVGs? I think people wrote that it doesn't work on Spectrum. |
What we've noticed is that a large number of sites don't use Showing how to use
Nope, SVGs won't work. That's my fault. 😅 I'm updating this issue with better details. |
Good call... |
I'd be interested in taking this one |
@lexishanson it's all yours! |
Yeah, didn't want it to sound like it's not important - images are often the biggest problem for loading speeds
If this sentence makes it analogous into the doc one should add to take that with a grain of salt :) |
@lexishanson Have you made any progress? Happy to help you with it if required! |
@tanvibhakta I implemented the changes but thank you for the offer! |
@jlengstorf There is a tutorial for adding images to a WordPress site here: https://www.gatsbyjs.org/docs/image-tutorial/ We could do something similar for just pulling local images in from the filesystem. Imho, this would be most effective as a recommended Advanced Tutorial after the main tutorial, since the main tutorial is already pretty long! |
@shannonbux I agree that the main tutorial is a bit long, but personally I'd recommend dropping other parts (e.g. the surge.sh setup) to make |
* install and config 'gatsby-image' plugins * add image to index * doc: add more detail to comment closes gatsbyjs/gatsby#9158
* install and config 'gatsby-image' plugins * add image to index * doc: add more detail to comment closes gatsbyjs/gatsby#9158
This brings up a good point that we send mixed signals: we want everyone to use
gatsby-image
because it automated image optimization, but we don't include it in the default starter.It seems to me that this might be worth exploring. The questions we'd have to ask are:1. Is adding a dummy image going to make people’s lives easier or harder?2. Would it be better to add a warning for unoptimized images, e.g. look for local links that don't use thegatsby-image
format?3. If we do add this, how should we structure the additional pieces (i.e. the images folder, extra docs).One suggestion would be to put the logo at the top left and use aStaticQuery
to display it. This provides a single component that has the query and usage forgatsby-image
, and a developer can eliminate all of the boilerplate by deleting theLogo
component andsrc/images/logo.svg
.Does anyone have strong opinions about this? If not, I think this would be a great Hacktoberfest PR!Update: we'd like to add this to the starter.
What we want to add
src/images/
gatsby-image
and its dependencies in the default starter, then configure the filesystem plugin to load imagesImage
atsrc/components/image.js
StaticQuery
to load the image and display it usinggatsby-image
Image
component tosrc/pages/index.js
The text was updated successfully, but these errors were encountered: