carbon-design-system / carbon-components-svelte

Svelte implementation of the Carbon Design System
https://svelte.carbondesignsystem.com
Apache License 2.0
2.68k stars 261 forks source link

refactor!: use `:global()` for custom styles #1940

Closed metonym closed 6 months ago

metonym commented 6 months ago

I'm currently working on rewriting the Carbon CSS optimize plugin: https://github.com/carbon-design-system/carbon-preprocess-svelte/pull/54

Here's one example of how much unused Carbon CSS can be eliminated (using #header-with-app-switcher).

Optimized assets/index-DekzpXBw.css
Before: 606.68 kB
After:   84.58 kB (-86.06%)

However, the current approach relies on explicit .bx-- selectors to avoid false positives.

This breaking change requires existing, custom styles to: