CSS variable with built-in color name replaced with color code on build
See original GitHub issueBug report
Describe the bug
I have added some css variable using scss map in global css with naming like below:
$colorPalette: (
red: #ff0000,
red1: #fa5e56,
red2: #DA291C,
red3: #d0021b,
red4: #4C191B,
black: #000000
)
:root {
@each $color, $value in $colorPalette {
--#{$color}: #{$value};
}
}
After building the project, I see variable becomes like below but in dev it works fine:
--red: #ff0000;
--red1: #fa5e56;
--red2: #DA291C;
--red3: #d0021b;
--red4: #4C191B;
--#000: #000;
To Reproduce
Just add a css variable with any builtin color name and build the project.
Expected behavior
After project building variables should remain like below:
--red: #ff0000;
--red1: #fa5e56;
--red2: #DA291C;
--red3: #d0021b;
--red4: #4C191B;
--black: #000;
System information
- OS: Ubuntu 20,4
- Browser (if applies) Any browser
- Version of Next.js: 9.4.4
- Version of Node.js: 12.16.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Using CSS custom properties (variables) - MDN Web Docs
They are set using custom property notation (e.g., --main-color: black; ) and are accessed using the var() function (e.g., color: var(--main- ...
Read more >Common CSS Color Variables and Properties in Theming
An effort to collect, categorize, and summarize some of the common CSS custom properties that are being used to maintain colors in modern ......
Read more >How to combine SASS color functions and CSS Variables
A new method, supported in all browsers, to store your colors in CSS Variables and modify them using SASS functions.
Read more >What do you name color variables?
I first give a name to all the colors I use using that tool, for example “$color-cornflower-blue: #6195ED;” and then I create variables...
Read more >Why can't update css variable name to apply a different ...
I think what you are trying to do, can not be done. SCSS is a CSS preprocessor which runs on the server-side. It...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I believe this has been resolved
my package.json
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.