support for nested rulesets inside dynamic mixins, with lexical scoping

This commit is contained in:
cloudhead 2010-03-07 20:20:50 -05:00
parent 01dac20cd8
commit be893c5993
3 changed files with 21 additions and 1 deletions

View File

@ -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));
}
}));
}
};

View File

@ -33,3 +33,9 @@ body {
.scope-mix {
width: 8;
}
.content {
width: 600px;
}
.content .column {
margin: 600px;
}

View File

@ -62,3 +62,11 @@ body {
.scope-mix {
.global-mixin(3);
}
.nested-ruleset (@width: 200px) {
width: @width;
.column { margin: @width; }
}
.content {
.nested-ruleset(600px);
}