Skip to content
Merged
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
17 changes: 12 additions & 5 deletions scss.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,13 +687,20 @@ protected function compileChild($child, $out) {
$this->throwError("Unexpected @content inside of mixin");
}

$this->storeEnv = $content->scope;
if(is_object($content)) {
$this->storeEnv = $content->scope;
if(count($content->children) > 0) {
foreach ($content->children as $child) {
if($child[0] == "include" || $child[0] == "block") {
$this->storeEnv = @$content->parent;
}
$this->compileChild($child, $out);
$this->storeEnv = $content->scope;
}
}

foreach ($content->children as $child) {
$this->compileChild($child, $out);
unset($this->storeEnv);
}

unset($this->storeEnv);
break;
case "debug":
list(,$value, $pos) = $child;
Expand Down
43 changes: 43 additions & 0 deletions tests/inputs/mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,46 @@ div {
color: blue;
}
}


// mixin content (http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#mixin-content)
@mixin content-simple {
div.mixin-content-simple {
@content;
}
}

@mixin content-with-arg ( $background ) {
div.mixin-content-with-arg {
background: $background;
@content;
}
}

@include content-simple {
color: red;
}

@include content-with-arg($background: blue) {
color: red;
}

@include content-with-arg($background: purple) {
@include hello_world;
}

@include content-simple {
@include cool(10px, 12px, 21px);
}

@include content-simple {
@include something(orange);
}

@include content-with-arg($background: purple) {
@include cool(10px, 12px, 21px);
}

@include content-with-arg($background: purple) {
@include something(orange);
}
29 changes: 29 additions & 0 deletions tests/outputs/mixins.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,32 @@ div p {
top: 0; }
div p .top div {
color: red; }

div.mixin-content-simple {
color: red; }

div.mixin-content-with-arg {
background: blue;
color: red; }

div.mixin-content-with-arg {
background: purple;
height: 20px; }

div.mixin-content-simple {
height: 43px; }

div.mixin-content-simple {
color: orange; }
div.mixin-content-simple div {
height: 20px; }

div.mixin-content-with-arg {
background: purple;
height: 43px; }

div.mixin-content-with-arg {
background: purple;
color: orange; }
div.mixin-content-with-arg div {
height: 20px; }