Skip to content

Commit d5aa97c

Browse files
committed
allow mixins to recursively reference each other leafo#208 leafo#203
1 parent 62701aa commit d5aa97c

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

lessc.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ function compileProp($prop, $block, $tags, &$_lines, &$_blocks) {
13571357
}
13581358

13591359
$old_parent = $mixin->parent;
1360-
$mixin->parent = $block;
1360+
if ($mixin != $block) $mixin->parent = $block;
13611361

13621362
foreach ($mixin->props as $sub_prop) {
13631363
$this->compileProp($sub_prop, $mixin, $tags, $_lines, $_blocks);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
@color: blue;
3+
4+
(~"something @{color}"), world {
5+
color: blue;
6+
}
7+
8+
.div {
9+
@color: red;
10+
(3434) {
11+
height: 100px;
12+
}
13+
14+
(~"cool @{color}") {
15+
height: 4000px;
16+
}
17+
}
18+
19+
.heck(@a) { color: @a+10 }
20+
21+
.spanX (@index) when (@index > 0) {
22+
(~".span@{index}") { .heck(@index) }
23+
.spanX(@index - 1);
24+
}
25+
.spanX (0) {}
26+
27+
.spanX (5);
28+
29+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
something blue, world { color:blue; }
2+
.div 3434 { height:100px; }
3+
.div cool red { height:4000px; }
4+
.span5 { color:15; }
5+
.span4 { color:14; }
6+
.span3 { color:13; }
7+
.span2 { color:12; }
8+
.span1 { color:11; }

0 commit comments

Comments
 (0)