Skip to content

Mixins with media queries using import reference produce invalid CSS #1962

Closed

Description

@danhart

If you mixin a media query to root (no selector) strange things occur. Also no error is raised.

base.less

@import (reference) "reference";
.test1;
.test2;

reference.less

.test1 {
    @media print {
        color: blue;
    }
}

.test2 {
    .nested {
        @media print {
            color: pink;
        }
    }
}

Output:

@media print {
  color: blue;
}

.test1 produces invalid CSS, .test2 produces nothing at all! Tested in 1.7.0.

Activity

  1. SomMeri commented on Jan 26, 2015

    @SomMeri
    Member

    This should be fixed by pull request #2410 the example compiles to:

    @media print {
      color: blue;
    }
    @media print {
      .nested {
        color: pink;
      }
    }
    

    Note: The incorrect css part is actually correct compilation resut - that is how the test1 mixin is defined.

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

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