Skip to content

Invalid media query merge of MQs inside @import with MQ #1508

@hparra

Description

@hparra

Tested with 1.4.2 RELEASE and 1.5.0-wip 6fe1174

A media query in a LESS file imported using import with a media query results in an invalid query.

import-test-f.less

@media screen and (min-device-pixel-ratio: 2) {
  #css {
    color: purple;
  }
}

import.less

@import "import/import-test-f" screen and (max-width: 604px);

The expected output is

@media screen and (max-width: 604px) and (min-device-pixel-ratio: 2) {
  #css {
    color: purple;
  }
}

but instead we have

@media screen and (max-width: 604px) and screen and (min-device-pixel-ratio: 2) {
  #css {
    color: purple;
  }
}

which is an invalid media query. [http://www.w3.org/TR/css3-mediaqueries/#syntax]

Furthermore, in 1.4.2 we have an empty media query with just max-width. This is no longer appearing in the 1.5.0-wip commit above.

Coincidently, the original test fails in 1.4.2 despite the fact that bin/lessc itself outputs the expected CSS. This seems to have been corrected in 1.5.0-wip as well.

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