The CSS minifier removes a leading & from nested selectors that also use & within other selector parts like :not(), which incorrectly changes the overall selector's meaning.
Reproduction: esbuild playground
Input:
.a {
.b:not(.a .b .b) {
--level: 1;
& .b:not(& .b .b) {
--level: 2;
& .b:not(& .b .b) {
--level: 3;
}
}
}
}
Output with esbuild 0.28.1 and --loader=css --minify:
.a{.b:not(.a .b .b){--level:1;.b:not(& .b .b){--level:2;.b:not(& .b .b){--level:3}}}}
The leading & before each nested .b:not(...) selector must be preserved, or the output must be rewritten to an equivalent selector. In the example above, given three nested .b elements, the input computes --level as 1, 2, and 3, while the minified output computes 3 for all three elements.
The CSS minifier removes a leading
&from nested selectors that also use&within other selector parts like:not(), which incorrectly changes the overall selector's meaning.Reproduction: esbuild playground
Input:
Output with esbuild 0.28.1 and
--loader=css --minify:The leading
&before each nested.b:not(...)selector must be preserved, or the output must be rewritten to an equivalent selector. In the example above, given three nested.belements, the input computes--levelas1,2, and3, while the minified output computes3for all three elements.