lightningcss
lightningcss copied to clipboard
Minification error when using nesting
Input
.bar {
@media (width > 10em) {
margin: auto;
div & {
color: red;
}
}
}
Output
.bar{@media (width>10em){margin:autodiv &{color:red}}}
Not sure what combination of nesting, media query and & leads to margin:autodiv...
I caught the same bug. And it seems to be related to the nested @media:
/* INPUT */
test-nesting {
@media (width >= 40em) {
color: beige;
&:hover {
color: wheat;
}
}
}
/* OUTPUT */
test-nesting{@media (width>=40em){color:beige&:hover{color:wheat}}}
/* Semicolon removed ↑ */
Но без @media обработка корректна:
/* INPUT */
test-nesting {
color: beige;
&:hover {
color: wheat;
}
}
/* OUTPUT */
test-nesting{color:beige;&:hover{color:wheat}}
/* Semicolon not removed ↑ */