postcss-custom-properties: removing duplicate rules #1396
-
Hi there, I have a question about duplicate values. As the docs say: :root {
--text-color: var(--color-pink);
}
div {
color: var(--text-color);
}
/* becomes */
:root {
--text-color: var(--color-pink);
}
div {
color: rgb(255, 192, 211);
color: var(--text-color);
} How can I remove :root {
--text-color: var(--color-pink);
}
div {
color: rgb(255, 192, 211);
} I need to inline that CSS and because the rule with the CSS variable is last, I get this: <div style="color: var(--text-color)"> When in fact I need it to use the value that was resolved: <div style="color: rgb(255, 192, 211)"> Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi @cossssmin,
It is not intended to "resolve" all variables. Maybe a tool like Sass is a better fit for this? There is the |
Beta Was this translation helpful? Give feedback.
You setup has too many other parts that are not maintained by us for us to help you with this :)
But I can say :
preserve: false
:postcssCustomProperties({ preserve: false }),