Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Dynamic classname in css file #337

Open
yogesh45 opened this issue Mar 31, 2021 · 2 comments
Open

Dynamic classname in css file #337

yogesh45 opened this issue Mar 31, 2021 · 2 comments

Comments

@yogesh45
Copy link

yogesh45 commented Mar 31, 2021

I am adding a scss file for my component

But after compiled in dist/index.css file the classname added inside my scss files get changed

SCSS :
.selected{
background-color: blue;
color: white;
}
.blured{
color: #ccc;
opacity: 0.5;
pointer-events: none;
}
.header{
width: 100px;
}

Index.css
._NBCalender__selected__2iz2b{
background-color: blue;
color: white;
}
._NBCalender__blured__2dYaJ{
color: #ccc;
opacity: 0.5;
pointer-events: none;
}
._NBCalender-style__selected__tbQ82 {
background-color: blue;
color: white; }

._NBCalender-style__blured__2f44- {
color: #ccc;
opacity: 0.5;
pointer-events: none; }

._NBCalender-style__header__3kezG {
width: 100px; }

Is there any way to fix this

@sadu
Copy link

sadu commented May 9, 2021

For some reason microbundle-crl treats *.scss files like modules and does this. Disabling css modules fixes this problem: https://github.com/developit/microbundle#css-and-css-modules

so in your package.json change the scripts to

    "build": "microbundle-crl --no-compress --no-css-modules --format modern,cjs",
    "start": "microbundle-crl watch --no-compress --no-css-modules --format modern,cjs",

@gabriel-visualthinking
Copy link

For some reason microbundle-crl treats *.scss files like modules and does this. Disabling css modules fixes this problem: https://github.com/developit/microbundle#css-and-css-modules

so in your package.json change the scripts to

    "build": "microbundle-crl --no-compress --no-css-modules --format modern,cjs",
    "start": "microbundle-crl watch --no-compress --no-css-modules --format modern,cjs",

Thank you! This did indeed work. Only problem is that now I can't use modules, so not the ideal solution, but I can make it work. I'm assuming there's no way to use both right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants