diff --git a/scss.inc.php b/scss.inc.php index d57a5e3b..92119ed2 100644 --- a/scss.inc.php +++ b/scss.inc.php @@ -732,8 +732,9 @@ protected function compileChild($child, $out) { $this->throwError("Expected @content inside of mixin"); } + $strongTypes = array('include', 'block', 'for', 'while'); foreach ($content->children as $child) { - $this->storeEnv = ($child[0] == 'include' || $child[0] == 'block') + $this->storeEnv = (in_array($child[0], $strongTypes)) ? null : $content->scope; diff --git a/tests/inputs/content.scss b/tests/inputs/content.scss index 2bd62dcf..55ca04e8 100644 --- a/tests/inputs/content.scss +++ b/tests/inputs/content.scss @@ -42,4 +42,20 @@ $color: white; } +@mixin respond-to($width) { + @media only screen and (min-width: $width) { @content; } +} + +@include respond-to(40em) { + @for $i from 1 through 2 { + .grid-#{$i} { width: 100%; } + } +} +@include respond-to(40em) { + $i: 1; + @while $i <= 2 { + .grid-#{$i} { width: 100%; } + $i: $i + 1; + } +} diff --git a/tests/outputs/content.css b/tests/outputs/content.css index 0f71094e..6657a216 100644 --- a/tests/outputs/content.css +++ b/tests/outputs/content.css @@ -15,3 +15,15 @@ @media only screen and (max-width: 480px) { #sidebar { width: 100px; } } + +@media only screen and (min-width: 40em) { + .grid-1 { + width: 100%; } + .grid-2 { + width: 100%; } } + +@media only screen and (min-width: 40em) { + .grid-1 { + width: 100%; } + .grid-2 { + width: 100%; } }