Does SASS support inline IF statements?

后端 未结 1 856
死守一世寂寞
死守一世寂寞 2020-12-10 02:12

I\'d like to set a SASS variable using inline IF\'s similar to how its done in PHP or Javascript

Is something like this possible?

$myVar: ($something         


        
相关标签:
1条回答
  • 2020-12-10 02:25

    Sass does support of conditional (ternary) operator or one line if statement as it works in languages like Javascript or PHP.

    $variable: if(condition, result-when-true, result-when-false);
    

    Article about improved if and what's new in Sass 3.3.
    P.S. Before Sass 3.3 it did not work as it should. Issue in Sass repo.

    0 讨论(0)
提交回复
热议问题