Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lessc.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ protected function compileProp($prop, $block, $out) {
list(, $child) = $prop;
$this->compileBlock($child);
break;
case 'ruleset':
case 'mixin':
list(, $path, $args, $suffix) = $prop;

Expand Down Expand Up @@ -720,6 +721,11 @@ protected function compileProp($prop, $block, $out) {
$this->throwError("{$prop[1][0]} is undefined");
}

if(strpos($prop[1][0], "$") === 0) {
//Use Ruleset Logic - Only last element
$mixins = array(array_pop($mixins));
}

foreach ($mixins as $mixin) {
if ($mixin === $block && !$orderedArgs) {
continue;
Expand Down Expand Up @@ -2458,6 +2464,16 @@ protected function parseChunk() {
$this->append(array("directive", $dirName, $dirValue));
return true;
}
} elseif ($this->literal(":", true)) {
//Ruleset Definition
if (($this->openString("{", $dirValue, null, array(";")) || true) &&
$this->literal("{"))
{
$dir = $this->pushBlock($this->fixTags(array("@".$dirName)));
$dir->name = $dirName;
if (isset($dirValue)) $dir->value = $dirValue;
return true;
}
}
}

Expand Down
11 changes: 11 additions & 0 deletions tests/inputs/ruleset.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@detached-ruleset: { background: red; border: none; };
@detached-ruleset: { background: blue; };

body {
.top {
@detached-ruleset();
}
}
.top {
@detached-ruleset();
}
6 changes: 6 additions & 0 deletions tests/outputs/ruleset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
body .top {
background: blue;
}
.top {
background: blue;
}