Open jantimon opened 1 month ago
I created a small next.js demo project with the following css code:
.page {
button {
color: green;
}
}
Stackblitz without postcss-nesting
without postcss-nesting .page { button { .. } }
is not pure:
however the same css code works once you add postcss-nesting
Stackblitz with postcss-nesting
to align both cases I created #72 - and to proof that .page button
I created a pr with a test case in #74
html { a_value: some-value; }
is not local - and thereforecss-modules/postcss-modules-local-by-default
marks them as not pure.However if only local selectors are inside that non local selector, it is still fine as all declarations are wrapped by a local selector. The following examples are pure:
As soon as a non local declaration gets added it still be marked as non pure. The following examples are NOT pure:
Especially the second case will be tricky to implement in the current code as by now only the selectors are analyzed to find out wether the code is pure or not.
In future we would have to iterate over every declaration and check for its surrounding selector wether it is pure or not.