mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
3326492b94
* Implement scopedStyleStrategy * Add changeset * Update compiler * Specify the eswalker version * Update compiler * Update .changeset/green-cups-hammer.md Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> * Update .changeset/green-cups-hammer.md Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/green-cups-hammer.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> --------- Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
21 lines
694 B
Markdown
21 lines
694 B
Markdown
---
|
|
'astro': minor
|
|
---
|
|
|
|
Implements a new class-based scoping strategy
|
|
|
|
This implements the [Scoping RFC](https://github.com/withastro/roadmap/pull/543), providing a way to opt in to increased style specificity for Astro component styles.
|
|
|
|
This prevents bugs where global styles override Astro component styles due to CSS ordering and the use of element selectors.
|
|
|
|
To enable class-based scoping, you can set it in your config:
|
|
|
|
```js
|
|
import { defineConfig } from 'astro/config';
|
|
|
|
export default defineConfig({
|
|
scopedStyleStrategy: 'class'
|
|
});
|
|
```
|
|
|
|
Note that the 0-specificity `:where` pseudo-selector is still the default strategy. The intent is to change `'class'` to be the default in 3.0.
|