support for nested rulesets inside dynamic mixins, with lexical scoping
This commit is contained in:
parent
01dac20cd8
commit
be893c5993
@ -45,7 +45,13 @@ tree.mixin.Definition.prototype = {
|
||||
context = { frames: [this, frame].concat(env.frames) };
|
||||
|
||||
return new(tree.Ruleset)(null, this.rules.map(function (rule) {
|
||||
return new(tree.Rule)(rule.name, rule.value.eval(context));
|
||||
if (rule.rules) {
|
||||
return new(tree.Ruleset)(rule.selectors, rule.rules.map(function (r) {
|
||||
return new(tree.Rule)(r.name, r.value.eval(context));
|
||||
}));
|
||||
} else {
|
||||
return new(tree.Rule)(rule.name, rule.value.eval(context));
|
||||
}
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
@ -33,3 +33,9 @@ body {
|
||||
.scope-mix {
|
||||
width: 8;
|
||||
}
|
||||
.content {
|
||||
width: 600px;
|
||||
}
|
||||
.content .column {
|
||||
margin: 600px;
|
||||
}
|
||||
|
@ -62,3 +62,11 @@ body {
|
||||
.scope-mix {
|
||||
.global-mixin(3);
|
||||
}
|
||||
|
||||
.nested-ruleset (@width: 200px) {
|
||||
width: @width;
|
||||
.column { margin: @width; }
|
||||
}
|
||||
.content {
|
||||
.nested-ruleset(600px);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user