Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixins with concatenated/nested selectors are undefined #1248

Closed
radium-v opened this issue Mar 28, 2013 · 4 comments
Closed

Mixins with concatenated/nested selectors are undefined #1248

radium-v opened this issue Mar 28, 2013 · 4 comments

Comments

@radium-v
Copy link
Contributor

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?

@lukeapage
Copy link
Member

Example?

@radium-v
Copy link
Contributor Author

.class {
    &-subclass { // <-- expands to .class-subclass
        display: block;
    }
}

.other-class {
    .class-subclass; // <--- fail
}

@lukeapage
Copy link
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.

@lukeapage
Copy link
Member

moving to #1270

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

No branches or pull requests

2 participants