Skip to content

Commit 498099d

Browse files
Brian Towlesrobocoder
authored andcommitted
added support for null default value in inline if
1 parent 5a4d80e commit 498099d

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

scss.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1868,7 +1868,7 @@ public function toRGB($hue, $saturation, $lightness) {
18681868
protected static $lib_if = array("condition", "if-true", "if-false");
18691869
protected function lib_if($args) {
18701870
list($cond,$t, $f) = $args;
1871-
if ($cond == self::$false) return $f;
1871+
if (!$this->isTruthy($cond)) return $f;
18721872
return $t;
18731873
}
18741874

tests/inputs/if_on_null.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@function testfunc($pseudo: null) {
2+
$output: if($pseudo, "green", "red");
3+
@return $output;
4+
}
5+
6+
body {
7+
background-color: testfunc();
8+
}

tests/outputs/if_on_null.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
body {
2+
background-color: "red"; }

0 commit comments

Comments
 (0)