Skip to content

Conversation

TrySound
Copy link
Member

@TrySound TrySound commented Feb 19, 2025

Closes #4796

CSS Cascade Layers are already widely support for almost 3 years. See https://developer.mozilla.org/en-US/docs/Web/CSS/@layer

We can switch to it instead of wrapping selectors with :where all preset selectors.

For older browsers impact will be insignificant as in most cases we use presets only to normalize browser styles.

Generated code now looks like this

@layer presets {
  div.w-box {
    display: block;
  }
}

Here's how presets look in chrome devtools. As you can see browser styles are defined as layer too.

Screenshot 2025-02-19 at 17 14 23

Closes #4796

CSS Cascade Layers are already widely support for almost 3 years.
See https://developer.mozilla.org/en-US/docs/Web/CSS/@layer

We can switch to it instead of wrapping selectors with `:where`
all preset selectors.

For older browsers impact will be insignificant as in most cases we use
presets only to normalize browser styles.

Generated code now looks like this

```css
@layer presets {
  div.w-box {
    display: block;
  }
}
```
@TrySound TrySound merged commit 326275f into main Feb 22, 2025
29 checks passed
@TrySound TrySound deleted the layers.staging branch February 22, 2025 05:45
istarkov pushed a commit that referenced this pull request Feb 23, 2025
Closes #4796

CSS Cascade Layers are already widely support for almost 3 years. See
https://developer.mozilla.org/en-US/docs/Web/CSS/@layer

We can switch to it instead of wrapping selectors with `:where` all
preset selectors.

For older browsers impact will be insignificant as in most cases we use
presets only to normalize browser styles.

Generated code now looks like this

```css
@layer presets {
  div.w-box {
    display: block;
  }
}
```

Here's how presets look in chrome devtools. As you can see browser
styles are defined as layer too.

<img width="357" alt="Screenshot 2025-02-19 at 17 14 23"
src="https://github.com/user-attachments/assets/473f2c0e-c7c5-4011-ba6b-4eeb1b805039"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch to cascade layers for presets in generated css

3 participants