Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 23, 2024
Merged

Conversation

metonym
Copy link
Collaborator

@metonym metonym commented Mar 23, 2024

I'm currently working on rewriting the Carbon CSS optimize plugin: carbon-design-system/carbon-preprocess-svelte#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:

  • Follow the .bx-- prefixing pattern
  • Be globally scoped (otherwise, the compiler will generate a hashed selector name)

@metonym metonym merged commit d5a1148 into master Mar 23, 2024
3 checks passed
@metonym metonym deleted the use-global-styles branch March 23, 2024 20:11
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.

None yet

1 participant