Skip to content

Mixins with concatenated/nested selectors are undefined #1248

Closed

Description

@radium-v

Hi,

I'm running into an issue when trying to reference a mixin that's named with a & combinator.

Example:

.sprite {

    .sprite(@x, @y, @w, @h) {
        background: transparent url(sprite.png) @x @y no-repeat;
        height: @h;
        width: @w;
    }

    &-derp { // .sprite-derp
        .sprite(-20px, -30px, 100px, 15px);
        display: block;
    }
}

.box {
    &:after {
        .sprite-derp;
        content: ' ';
        position: absolute;
    }
}

Should output:

.sprite-derp {
    background-position: -20px -30px;
    height: 15px;
    width: 100px;
    display: block;
}

.box:after {
    background-position: -20px -30px;
    height: 15px;
    width: 100px;
    content: ' ';
    position: absolute;
}

Would it be possible to implement this functionality, or am I just doing it wrong?

Activity

  1. lukeapage commented on Mar 29, 2013

    @lukeapage
    Member

    Example?

  2. radium-v commented on Mar 29, 2013

    @radium-v
    ContributorAuthor
    .class {
        &-subclass { // <-- expands to .class-subclass
            display: block;
        }
    }
    
    .other-class {
        .class-subclass; // <--- fail
    }
  3. lukeapage commented on Apr 2, 2013

    @lukeapage
    Member

    yes, its not supported and no plans to support it.. it's difficult to work out the selector .sprite-derp till a phase after all the mixin calls have been processed. for a work-around you could use extends instead.

  4. lukeapage commented on Jun 14, 2013

    @lukeapage
    Member

    moving to #1270

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