-
Notifications
You must be signed in to change notification settings - Fork 458
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
Imgix plugin #849
Imgix plugin #849
Conversation
Quick look and images are not showing on the preview site - without much digging I wonder if that has to do with the context? If that's the case it'd actually be important to have the images in dev too |
d76883b
to
a0fafb2
Compare
whoops, forgot some quotes |
I think there might be a caching issue with the deploy preview now. :/ |
@mariusandra still no images :( |
Oh if it's a cache issue that's easy, I'll retrigger a deploy without cache |
Done - let's see |
Yup that's working now, and the great news is, for a cacheless build:
|
Once #848 is merged, this can be added on top.
This adds a custom gatsby plugin that rewrites local images to use imgix in production builds (disabled for branch and deploy previews).
It finds every local image, gets its dimensions and then generates a srcSet attribute with matching imgix urls.
For an image like:
https://posthog.com/static/33fac05700a7fd86bd306b4c829493e7/d9ed5/toolbar-landing-page.png
We will generate urls like:
https://posthog.imgix.net/static/33fac05700a7fd86bd306b4c829493e7/d9ed5/toolbar-landing-page.png?w=500
... with different values for
w
.PR #848 needs to be merged first, as without the
gatsby-remark-images
plugin, the image URLs will be different, more like/static/feature-flags-1e8c20eefc3f0f8e8e72c0ce8101afcf.png
instead of/static/hash1/hash2/feature-flags.png
. If the new images are uploaded to production, we can test locally that this works withenabled: true
before finally merging this.