Description
Hi,
first of all: this is a great plugin and I appreciate that you are spending your (free) time to help all of us.
I don't know whether it's a bug or not but I think I found a combination where the fallback for css variables isn't replaced correctly (I'm using webpack 5.74.0 with the dependencies postcss 8.4.16, postcss-loader 7.0.1 and postcss-preset-env 7.8.1).
In the past I wrote a (scss) definition like this:
.stage__container {
...
left: var(--size, $spacer);
...
}
This works as expected.
Now I am trying to use logical properties in order to use modern css and prevent duplicate code (in the scss file) for the arabic landingpage:
.stage__container {
...
inset-inline-start: var(--size, $spacer);
...
}
But this doesn't seem to work because in the end the fallback is rendered twice - once with the var style and its fallback and once with only the fallback (please take a look at the order):
The same behavior occurs when I'm setting the fallback as a root variable instead of the custom property:
:root {
--size: 1rem;
}
.stage__container {
...
inset-inline-start: var(--size);
...
}
Setting the preserve option doesn't change this behavior for me.
The only way that works for me is this one:
.stage__container {
...
inset-inline-start: var(--size);
...
}
But then there is no fallback for older browsers (we build a global website that is accessed by many older browsers following the usage stats).
I found out that the logical properties plugin seems to handle these (incorrect) replacements and that disabling it prevents the duplicate code. But then again there is no fallback for older browsers.
Can you recreate this behavior?
Best regards,
Benjamin