qw3n qw3n - 1 year ago 157
Sass (Sass) Question

How do set a SCSS variable to an empty string?

I saw an interesting technique where you could use

to add a prefix to styles. So the problem I'm running into is making it an option not to set the prefix. No matter what I try I get
Error: Base-level rules cannot contain the parent-selector-referencing character '&'
from the sass compiler. So is there any way to add prefixing option but not make it required?


Answer Source

Try to use inline condition for & sign. Like this:

$n: if($prefix != '', '&', '');

#{$n}color {
  color: red;
#{$n}left {
  float: left;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download