Stephen Thomas Stephen Thomas - 1 year ago 130
Sass (Sass) Question

SCSS if function without false (else) clause

Anyone know of a way to use the SASS

function (not the
directive) without a false (aka else) clause?

Use Case: I have a SASS library that's normally used on its own and includes a full CSS reset. Someone wants to take an individual file from the library and add it to a project that includes Zurb Foundation, which, of course, totally destroys the CSS reset. I'd like to accommodate that use case with something like:

$css-reset: false !default;

.form__input {
border-radius: 4px if(not $css-reset, !important);

That's a SASS compile error, though, since the compiler requires a third parameter to the

Thanks in advance

Answer Source

Not super elegant, but this works:

border-radius: 4px if(not $css-reset, !important, unquote("");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download