-
Notifications
You must be signed in to change notification settings - Fork 40
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
Move css vars from body style tag to separate style node #219
base: v2
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
v2/pink-sb/src/lib/Root.svelte
Outdated
$: { | ||
const cssVariables = Object.keys(theme) | ||
.map((key) => `--${key}: ${theme[key]};`) | ||
.join(' '); | ||
const styleElement = document.createElement('style'); | ||
document.head.prepend(styleElement); | ||
styleElement.textContent = `:root {${cssVariables}}`; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will be creating a style element each time this is triggered.
Maybe we can try and use the <svelte:head />
special element.
<svelte:head>
<style>{style}</style>
</svelte:head>
What does this PR do?
Have you read the Contributing Guidelines on issues?
✅