Skip to content

Conversation

@ascorbic
Copy link
Contributor

Description (required)

Updates the experimental flag docs to reflect the changes in withastro/astro#13677. It also expands the docs to explain the feature in more detail, including explanations of why to use it, and a note about potential impact on build times. It adds a note on use with Tailwind 4.

Related issues & labels (optional)

  • Closes #
  • Suggested label:

@ascorbic ascorbic added the merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) label Apr 24, 2025
@netlify
Copy link

netlify bot commented Apr 24, 2025

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 429b269
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/680b53864246a30008efecd2
😎 Deploy Preview https://deploy-preview-11513--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@astrobot-houston
Copy link
Contributor

astrobot-houston commented Apr 24, 2025

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/reference/experimental-flags/responsive-images.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a few comments, mostly just breaking text up into more paragraphs.

I made two suggestions for the new image layout options list, because I think it's helpful that all of them have a "use for/useful for" ... these might not be the best choices, but I think if we can put something concrete in there, that will help people choose!


In order to generate the correct `srcset` and `sizes` attributes, the `<Image />` and `<Picture />` components need to know how the image should resize when its container changes size. This is done by setting the `layout` prop, or `image.experimentalLayout` default. The supported values are:

- `constrained` - The image will scale to fit the container, maintaining its aspect ratio, but will not exceed the specified `width` and `height`, or the image's original dimensions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `constrained` - The image will scale to fit the container, maintaining its aspect ratio, but will not exceed the specified `width` and `height`, or the image's original dimensions.
- `constrained` - The image will scale to fit the container, maintaining its aspect ratio, but will not exceed the specified `width` and `height`, or the image's original dimensions. Use this for images that should be responsive, but only when smaller than the original (or a specified) size.

I like how the others had a "Use this/this is useful" so something like this maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done new wording, including saying that if they're unsure they should choose this, and that it matches the default Tailwind styles


- `constrained` - The image will scale to fit the container, maintaining its aspect ratio, but will not exceed the specified `width` and `height`, or the image's original dimensions.
- `full-width` - The image will scale to fit the width of the container, maintaining its aspect ratio. Use this for hero images or other images that should take up the full width of the page.
- `fixed` - The image will maintain the requested dimensions and not resize. The `srcset` will be generated for the requested image size, plus 2x resolution for high-density displays if the source image is large enough.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `fixed` - The image will maintain the requested dimensions and not resize. The `srcset` will be generated for the requested image size, plus 2x resolution for high-density displays if the source image is large enough.
- `fixed` - The image will maintain the requested dimensions and not resize. The `srcset` will be generated for the requested image size, plus 2x resolution for high-density displays if the source image is large enough. Use this when you prefer to see your image cropped at smaller sizes instead of showing a smaller version of the whole picture.

OK, I don't love this, but I do think an explanation of the container making only part of the image visible, at its original size, is helpful here for the Use when.../Useful for...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I clearly need to explain this better, because this isn't what it does! It just displays them with no resizing at all, like a normal img tag with no styling.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've rewritten this to try and make it clearer. lmk if it makes sense!

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Appreciate the extra detail, and I think it's helpful to have the extra guidance for choosing! LGTM (I think the patch was already released, so this merges any time now?)

@sarah11918 sarah11918 added the improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes) label Apr 25, 2025
@ascorbic ascorbic self-assigned this Apr 25, 2025
@ascorbic
Copy link
Contributor Author

No, it's in this release: withastro/astro#13676

@sarah11918
Copy link
Member

Also merge #11532 when this is merged!

@ascorbic ascorbic merged commit b8da673 into main Apr 28, 2025
10 checks passed
@ascorbic ascorbic deleted the resp-img-changes branch April 28, 2025 06:07
ArmandPhilippot added a commit to ArmandPhilippot/astro-docs that referenced this pull request Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes) merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants