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

Nested rules inside mixins #12

Closed
jamesfoster opened this issue Apr 10, 2010 · 1 comment
Closed

Nested rules inside mixins #12

jamesfoster opened this issue Apr 10, 2010 · 1 comment

Comments

@jamesfoster
Copy link
Contributor

Not sure if this is an intentional restriction but the following doesn't seem to work

.mixin() {
    a {
        color: red;
        span { color: blue; }
    }
}
.class { .mixin; }

should output

.class a {
    color: red;
}
.class a span {
    color: blue;
}

it only works with one level of nesting, the second level is lost when you run this code in mixin.js:

return new(tree.Ruleset)(rule.selectors, rule.rules.map(function (r) {
    return new(tree.Rule)(r.name, r.value.eval(context));
}));

You could also change this area of code to allow a mixin.Call or even a mixin.Definition inside another mixin.Definition.

@cloudhead
Copy link
Member

Ok, fixed this. I'm not allowing nested mixin.Definitions (yet), as it doesn't really make sense. But you can now call a mixin from inside another mixin, and nesting works properly.

dhaber pushed a commit to dhaber/less.js that referenced this issue Jan 14, 2014
Fix for some tests that were failing on my Mac
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants