less.js icon indicating copy to clipboard operation
less.js copied to clipboard

Produces invalid media query from nested conditions

Open Knutas opened this issue 3 years ago • 1 comments

To reproduce:

@media (max-width: 500px) {
  @media screen {
    body {
      background-color: red;
    }
  }
}

Current behavior:

Produces invalid css with and screen at the end of the media query.

@media (max-width: 500px) and screen {
  body {
    background-color: red;
  }
}

Expected behavior:

screen and added to the start of the media query.

@media screen and (max-width: 500px) {
  body {
    background-color: red;
  }
}

Environment information:

http://lesscss.org/less-preview/

Knutas avatar Feb 21 '22 14:02 Knutas

Hello , I have solved your problem :

reproduice

@media screen {           @media (max-width: 500px) {                      body {                              background-color: red;                      }            } }

you just had to reverse "screen" and "(max-width: 500px)"

guelate avatar Mar 09 '22 13:03 guelate