if.scss in Responsive Menu – Create Mobile-Friendly Menu 3.0.6, at src/app/Mappers/scssphp/tests/inputs/if.scss
| 1 | |
| 2 | @function conds($val) { |
| 3 | @if $val { |
| 4 | @return "red"; |
| 5 | } |
| 6 | |
| 7 | @return "blue"; |
| 8 | } |
| 9 | |
| 10 | div { |
| 11 | @if something { |
| 12 | color: blue; |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | pre { |
| 17 | val-1: conds(true); |
| 18 | val-2: conds(false); |
| 19 | val-3: conds(null); |
| 20 | val-4: conds(1); |
| 21 | val-5: conds(0); |
| 22 | } |
| 23 | |
| 24 | |
| 25 | span { |
| 26 | @if false { |
| 27 | color: red; |
| 28 | } @else { |
| 29 | color: blue; |
| 30 | } |
| 31 | |
| 32 | @if true { |
| 33 | height: 10px; |
| 34 | } @else { |
| 35 | color: 20px; |
| 36 | } |
| 37 | |
| 38 | @if false { |
| 39 | height: 10px; |
| 40 | } @elseif false { |
| 41 | color: 20px; |
| 42 | } @else { |
| 43 | width: 20px; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | div { |
| 48 | @if false { |
| 49 | color: red; |
| 50 | } @else if false { |
| 51 | color: green; |
| 52 | } @else { |
| 53 | color: blue; |
| 54 | } |
| 55 | |
| 56 | @if false { |
| 57 | border-color: red; |
| 58 | } @else if true { |
| 59 | border-color: green; |
| 60 | } @else { |
| 61 | border-color: blue; |
| 62 | } |
| 63 | |
| 64 | } |
| 65 | |
| 66 | // doesn't work in scss, thing loses scope |
| 67 | del { |
| 68 | @if false { |
| 69 | $thing: yes; |
| 70 | } @else { |
| 71 | $thing: no; |
| 72 | } |
| 73 | |
| 74 | thing: $thing; |
| 75 | } |
| 76 | |
| 77 |