-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 queries: parentheses needed even without --strict-math=on #1480
Comments
ah, a bit of a edge case.. we force strict maths on in media queries so that people can use fractions, thanks for raising the issue. |
👍 Also seeing this on less 2.5.1. The suggested workaround of putting parenthesis around the variable in the media query works. Trivial problem case: @foo: 10px;
@bar: 20px;
@baz: @foo + @bar;
.test {
@media (min-width: @baz) {
color: red;
}
} Compiled CSS of trivial problem case (invalid): @media (min-width: 10px + 20px) {
.test {
color: red;
}
} Trivial problem case with workaround: @foo: 10px;
@bar: 20px;
@baz: @foo + @bar;
.test {
@media (min-width: (@baz)) {
color: red;
}
} Compiled CSS of trivial problem case with workaround: @media (min-width: 30px) {
.test {
color: red;
}
} |
We're also affected by this in Moodle as this issue affects the stock version 2.3 of bootstrap. In this case the variable is assigned (https://github.com/twbs/bootstrap/blob/v2.3.2/less/variables.less#L181):
The media-query is (https://github.com/twbs/bootstrap/blob/v2.3.2/less/responsive-navbar.less#L181):
This leads to an output of:
|
I tried doing something like
so as to avoid creating the extra less variable, but this doesn't work, any ideas why? |
Currently parens are required for arithmetic expressions in @media (min-width: (@navbarCollapseWidth + 1)) { } |
I get an error for
Error loading "app/styles/index.less!$less" from "app/app" at http://localhost:63342/foo/app/app.js Expected ')'" |
You're mixin up |
!breaking change, fixes #1480
This example produces different output under less 1.3.3 and 1.4.2:
Output with less 1.3.3:
Output with less 1.4.1:
Adding parentheses around
@dpr * 96dpi
makes less 1.4.1 output the same as 1.3.3, but this was an unexpected gotcha with the upgrade to 1.4.x.The text was updated successfully, but these errors were encountered: