Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media query express support #3735

Closed
woody-li opened this issue Jun 27, 2022 · 6 comments
Closed

Media query express support #3735

woody-li opened this issue Jun 27, 2022 · 6 comments

Comments

@woody-li
Copy link

A new range syntax introduced in Media Queries Level 4.

The syntax allow query expresses, includes range express.

But i got an error when using the syntax.

To reproduce:

@media (400px <= width <= 700px) {
    .main-box {
        display: flex;
    }
}

Current behavior:

less: Missing closing ')' in file test.less line no. 1

Expected behavior:

Convert to css with the syntax correctly

Environment information:

  • less version: 4.1.3
  • nodejs version: 16.14.0
  • operating system: win
@woody-li woody-li added the bug label Jun 27, 2022
@iChenLei iChenLei self-assigned this Jun 27, 2022
@mud1tx
Copy link

mud1tx commented Mar 30, 2023

I think I can work on this issue. Can you please give some details about the issue?

@woody-li
Copy link
Author

@mud1tx Thanks for your reply. I'd like to provide something, but I don't know what to provide.

@matthew-dean
Copy link
Member

@mud1tx This isn't a bug, it's technically a feature request. So what needs to be added is support for range syntax in media queries. This would need to support merging as well.

That is, right now Less transforms this:

@media screen {
  @media (min-width: 1023px) {
    .selector {
      color: blue;
    }
  }
}

...into...

  @media screen and (min-width: 1023px) {
    .selector {
      color: blue;
    }
  }

So, tests would need to be added to convert:

@media (400px <= width) {
  @media (width <= 700px) {
    .main-box {
        display: flex;
    }
  }
}

into:

@media (400px <= width) and (width <= 700px) {
    .main-box {
        display: flex;
    }
}

@jiadesen
Copy link

jiadesen commented Apr 7, 2023

me too

[vite:css] [less] Missing closing ')'

@jiadesen
Copy link

jiadesen commented Apr 7, 2023

stylelint/stylelint#6742

@woody-li
Copy link
Author

The range syntax seems has been supported in version 4.2.0 by PR #3811

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants