Weird issue with scoped styling and global CSS variables #295
Unanswered
daanvanham
asked this question in
Q&A
Replies: 2 comments 2 replies
-
How is this set/imported? Do you have a reproduction we can take a look at? |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
You should not use sass // setup file
import './global.scss' |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I'm not sure wether it is me who did something stupid or if this is a bug, but here's my story;
I have a global stylesheet where color variables are set with CSS variables like so:
In my component I use this color to set a background for a button:
Now when I add a Story to my Histoire, I get this as the output for the css:
Because of the
data-attribute which is added before:root, I now don't have access to the CSS variable and my button doesn't have the right background color.When I add another style block to my component which doesn't have
scopedset, it does work, even if I add it with only a comment:Now there's an extra
<style>block in the iframe in Histoire where the:rootvariables are set without thedata-attribute.Am I missing something here or is this a bug?
Beta Was this translation helpful? Give feedback.
All reactions