Skip to content

Commit 3cbdd63

Browse files
authored
Trim trailing zeros
1 parent 9b3c1ff commit 3cbdd63

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Node/Number.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,9 @@ public function output(Compiler $compiler = null)
291291

292292
reset($units);
293293
$unit = key($units);
294-
295-
return preg_replace('/[.]0*$/', '', number_format($dimension, static::$precision)) . $unit;
294+
$dimension = number_format($dimension, static::$precision, '.', '');
295+
296+
return (static::$precision ? rtrim($dimension, '0') : $dimension) . $unit;
296297
}
297298

298299
/**

0 commit comments

Comments
 (0)