Is it possible to import a class name from CSS module inside another module? #10084
Unanswered
Kadeluxe
asked this question in
Help/Questions
Replies: 1 comment 3 replies
-
importing modules imports all content of imported module to destination. create shared file with class name and import it anywhere in js or in (s)css @value btn from "../../style/shared/btn.module.scss"; btn.module.scss with empty class: .btn{
} im my case thats works fine. P.S don't use special words as @value. parser will replace all of these. @value flex from
.flex {
display: flex;
} generated .flex_fdsfsd {
display: flex_fdsfsd;
} |
Beta Was this translation helpful? Give feedback.
3 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.
Uh oh!
There was an error while loading. Please reload this page.
-
Basically, how to target a selector from
child.module.scss
inparent.module.scss
?https://stackblitz.com/edit/vitejs-vite-vce7hy?file=src%2Fcomponents%2FParent%2FParent.vue
I was under impression that my example should work given it resolves a

@value
fromchild.module.scss
:but instead
Parent
has its style like that:so it imports the
@value
but also somehow includes thechild.module.scss
and gets wrong.child
selector.Meanwhile, JS import gets correct
.child
selector.Is it a bug?
Is there a way to do that in Vue?
Note: I'm aware that this example can be written in other way to still style the
Child
.My question is about CSS modules in general.
I ask about the possibility to import a class from another CSS module.
Beta Was this translation helpful? Give feedback.
All reactions