Minor Changes
-
#4907
01c1aaa00
Thanks @matthewp! - Order Astro styles last, to override imported stylesThis fixes CSS ordering so that imported styles are placed higher than page/component level styles. This means that if you do:
--- import '../styles/global.css'; --- <style> body { background: limegreen; } </style>
The
<style>
defined in this component will be placed below the imported CSS. When compiled for production this will result in something like this:/* /src/styles/global.css */ body { background: blue; } /* /src/pages/index.astro */ body:where(.astro-12345) { background: limegreen; }
Given Astro's 0-specificity hashing, this change effectively makes it so that Astro styles "win" when they have the same specificity as global styles.
-
#4876
d3091f89e
Thanks @matthewp! - Adds the Astro.cookies APIAstro.cookies
is a new API for manipulating cookies in Astro components and API routes.In Astro components, the new
Astro.cookies
object is a map-like object that allows you to get, set, delete, and check for a cookie's existence (has
):--- type Prefs = { darkMode: boolean; }; Astro.cookies.set<Prefs>( 'prefs', { darkMode: true }, { expires: '1 month', } ); const prefs = Astro.cookies.get<Prefs>('prefs').json(); --- <body data-theme={prefs.darkMode ? 'dark' : 'light'}></body>
Once you've set a cookie with Astro.cookies it will automatically be included in the outgoing response.
This API is also available with the same functionality in API routes:
export function post({ cookies }) { cookies.set('loggedIn', false); return new Response(null, { status: 302, headers: { Location: '/login', }, }); }
See the RFC to learn more.
Patch Changes
-
#4892
ff7ba0ee0
Thanks @matthewp! - Prevent multiple rendering of head content -
#4842
812658ad2
Thanks @bluwy! - Add missing dependencies, support strict dependency installation (e.g. pnpm) -
#4891
87a7cf48e
Thanks @matthewp! - Hoist hydration scripts out of slot templates -
Updated dependencies [
812658ad2
,812658ad2
]:- @astrojs/markdown-remark@1.1.3
- @astrojs/telemetry@1.0.1