Gerillass

v2.1.0

Clear Whitespace

Type: Function
clearWhitespace();

Removes every space from a string.

Arguments

NameTypeDescription
$stringstringAccepts any string.

Examples

Turning a font family name into a filename.

Sass
.brand {
  font-family: "Fanwood Text", serif;
  background-image: url("/fonts/#{clearWhitespace("Fanwood Text")}.svg");
}
CSS
.brand {
  font-family: "Fanwood Text", serif;
  background-image: url("/fonts/FanwoodText.svg");
}

What it refuses

Arguments are checked, so a wrong value stops the build with a message instead of quietly producing the wrong CSS.

Sass
$size: 16;
.brand {
  background-image: url("/fonts/#{clearWhitespace($size)}.svg");
}
Error: `16` is not a valid $string for `clearWhitespace`. Pass a string.