Skip to content

Parent selectors (in mixins) are ignored in referenced files #1646

Closed

Description

@nsdcss

Hi, I am playing around with the new @import (reference) ... feature and encountered a strange behavior.

If I am using the parent selector "&" inside a mixin that is located in a file that is imported with the (reference) statement (and then call the mixin from another file) all the parent-selectors are ignored.

So if I have this in the mixin:

a {
  color: #f00;
  &:hover {
    color: #0f0;  
  }
}

This is what comes out:

a {
  color: #f00;
}

Beside that the reference feature is really great. Thank you for that.

Activity

  1. seven-phases-max commented on Dec 28, 2013

    @seven-phases-max
    Member

    Wasn't it fixed in 1.5.1? At least I can't reproduce this with current master. Well, the above example is a bit awkward since a can't be a mixin, but if I compile something like this:

    // other.less:
    .a {
        color: #f00;
        &:hover {
            color: #0f0;  
        }
    } 
    
    // this.less:
    @import (reference) "other";
    
    z {.a}
    

    it works as expected.

  2. seven-phases-max commented on Feb 3, 2014

    @seven-phases-max
    Member

    Ok, closing due to inactivity (not reproducable with Less 1.5 and later).

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