🍿 Minor Changes
-
#13965
95ece06Thanks @ematipico! - Adds support for the experimental static headers Astro feature.When the feature is enabled via option
experimentalStaticHeaders, and experimental Content Security Policy is enabled, the adapter will generateResponseheaders for static pages, which allows support for CSP directives that are not supported inside a<meta>tag (e.g.frame-ancestors).import { defineConfig } from 'astro/config';import vercel from '@astrojs/vercel';export default defineConfig({adapter: vercel({experimentalStaticHeaders: true,}),experimental: {cps: true,},});
🐞 Patch Changes
-
#13917
e615216Thanks @ascorbic! - The responsive images feature introduced behind a flag in v5.0.0 is no longer experimental and is available for general use.The new responsive images feature in Astro automatically generates optimized images for different screen sizes and resolutions, and applies the correct attributes to ensure that images are displayed correctly on all devices.
Enable the
image.responsiveStylesoption in your Astro config. Then, set alayoutattribute on anyor component, or configure a default image.layout, for instantly responsive images with automatically generatedsrcsetandsizesattributes based on the image’s dimensions and the layout type.Displaying images correctly on the web can be challenging, and is one of the most common performance issues seen in sites. This new feature simplifies the most challenging part of the process: serving your site visitor an image optimized for their viewing experience, and for your website’s performance.
For full details, see the updated Image guide.
The
experimental.responsiveImagesflag has been removed, and all experimental image configuration options have been renamed to their final names.If you were using the experimental responsive images feature, you’ll need to update your configuration:
Remove the experimental flag
export default defineConfig({experimental: {responsiveImages: true,},});Update image configuration options
During the experimental phase, default styles were applied automatically to responsive images. Now, you need to explicitly set the
responsiveStylesoption totrueif you want these styles applied.export default defineConfig({image: {responsiveStyles: true,},});The experimental image configuration options have been renamed:
Before:
export default defineConfig({image: {experimentalLayout: 'constrained',experimentalObjectFit: 'cover',experimentalObjectPosition: 'center',experimentalBreakpoints: [640, 750, 828, 1080, 1280],experimentalDefaultStyles: true,},experimental: {responsiveImages: true,},});After:
export default defineConfig({image: {layout: 'constrained',objectFit: 'cover',objectPosition: 'center',breakpoints: [640, 750, 828, 1080, 1280],responsiveStyles: true, // This is now *false* by default},});Component usage remains the same
The
layout,fit, andpositionprops on<Image>and<Picture>components work exactly the same as before:<Imagesrc={myImage}alt="A responsive image"layout="constrained"fit="cover"position="center"/>If you weren’t using the experimental responsive images feature, no changes are required.
Please see the Image guide for more information on using responsive images in Astro.
-
Updated dependencies []:
- @astrojs/underscore-redirects@1.0.0