Open ar53n opened 5 years ago
Currently, if it is an invalid declaration, it will just fallback and work as expected.
postcss-color-function
choke and throw an error with color: color(var(--red) a(90));
? Can you ignore those errors?Input:
:root {
--red: #f00;
--pl: 15px;
}
.box {
color: color(var(--red) a(90));
padding-left: var(--pl);
}
Current output running just postcss-css-variables
with options.preserve = true
:root {
--red: #f00;
--pl: 15px;
}
.box {
color: color(#f00 a(90));
color: color(var(--red) a(90));
padding-left: 15px;
padding-left: var(--pl);
}
@MadLittleMods I did want just ignore some rules for preserve. For example not preserve line for color function. Because in Chrome its line work, but not correctly. And I want delete source line and to stay only fallback. Also have many plugins that can't work with custom properties and throw error when try to parse
options: {
preserve: [
true,
{
// some strings or regexp for ignore
}
]
}
@ar53n So I can understand your use case better:
preserve: false
? If not, why?postcss-color-function
could handle on removing any color()
declarations it fails to parseFor reference on color: color(var(--red) a(90));
looking valid in Chrome so it doesn't fallback.
I too would like some sort of way to declare that a specific var
should be left as is and not transformed. Maybe like
padding-left: var(--p1); /* @postcss-css-variables-exception */
My idea is to add an option to exclude only some variables. Because I have
postcss-color-function
plugin, I don't want preserve all these variables.For example I don't want preserve variables with color function.
Input:
Ideal/expected Result: