P
P
pqgg7nwkd42018-05-03 16:17:07
css
pqgg7nwkd4, 2018-05-03 16:17:07

How to use scss variables to declare css variables?

I'm using webpack to build.
I'm trying to collect:

$bg-color: green;
body {
  --background-color: $bg-color;
  background-color: $bg-color;
}

I get:
body {
  --background-color: $bg-color;
  background-color: green; 
}

As you can see, one of the uses of the variable has remained in place. How to fix? webpack 4.6.0 node-sass version "4.9.0" sass-graph version "2.2.4" sass-loader version "7.0.1" $bg-color;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2018-05-03
@pqgg7nwkd4

body {
  --background-color: #{$bg-color};
  background-color: $bg-color;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question