Skip to content

Calculations in media query declarations no longer work #3265

Closed
@JamesDonnelly

Description

@JamesDonnelly

Today I upgraded a project of mine from LESS 3.0.4 to 3.5.0.

In LESS 3.0.4, the following was perfectly valid:

@media screen and (min-width: (@some-var + 1)) {
  ...
}

However in 3.5.0, the @some-var + 1 part means this entire media query gets excluded from the compiled CSS as if it never existed. No errors are given in the build console (compiling using Webpack and less-loader (neither of which were also updated today)).

I've worked around it for now by performing the calculation on a separate @some-var-plus-one variable:

@some-var-plus-one: @some-var + 1;

@media screen and (min-width: @some-var-plus-one) {
  ...
}

I'm not sure if this is a bug or if this is something intentional.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions