feat: Add CSS variables in getImage for experimental.responsiveImages #13256
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
experimental.responsiveImages
only adds CSS variables to images included via the<Image />
or<Picture />
components.getImage
to transform images.getImage
participate more fully in the responsive images experiment.getImage
removes a lot of redundant/confusing logic anyways.Testing
I tested this change by running my personal blog with it on. It provides a better outcome than when
getImage
is used on its own with this experiment turned on:Note: the before pic has
width: 100%
applied to it in page styles. Without that, it looks even worse (no scaling applied based on page size)Docs
We may need to update the doc page on this (https://docs.astro.build/en/reference/experimental-flags/responsive-images/), as well as the RFC (https://github.com/withastro/roadmap/blob/eff726cec3bf214b42ab13b819ed7b200753509e/proposals/0053-responsive-images.md). Currently, neither make mention of
getImage
being affected by this experiment./cc @withastro/maintainers-docs for feedback!