Gerillass

v2.1.0

Pixelify

Type: Function
pixelify();

Returns the value with a px unit, adding one if it is missing.

Arguments

NameTypeDescription
$valuenumberAccepts a number, with or without a unit.

Examples

Accepting a size with or without a unit.

Sass
.icon {
  width: pixelify(24);
  height: pixelify(24px);
}
CSS
.icon {
  width: 24px;
  height: 24px;
}

What it refuses

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

Sass
.icon {
  width: pixelify("24");
}
Error: `24` is not a valid $value for `pixelify`. Pass a number, with or without a unit.