File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -424,8 +424,11 @@ namespace Sass {
424
424
// if after applying precsision, the value gets
425
425
// truncated to zero, sass emits 0.0 instead of 0
426
426
bool nonzero = n->value () != 0 ;
427
- for (size_t i = d.length ()-1 ; d[i] == ' 0' ; --i) {
428
- d.resize (d.length ()-1 );
427
+ size_t decimal = d.find (' .' );
428
+ if (decimal != string::npos) {
429
+ for (size_t i = d.length ()-1 ; d[i] == ' 0' && i >= decimal; --i) {
430
+ d.resize (d.length ()-1 );
431
+ }
429
432
}
430
433
if (d[d.length ()-1 ] == ' .' ) d.resize (d.length ()-1 );
431
434
if (n->numerator_units ().size () > 1 ||
@@ -444,6 +447,9 @@ namespace Sass {
444
447
// use fractional output if we had
445
448
// a value before it got truncated
446
449
if (d == " 0" && nonzero) d = " 0.0" ;
450
+ // if the precision is 0 sass cast
451
+ // casts to a float with precision 1
452
+ if (ctx->precision == 0 ) d += " .0" ;
447
453
// append number and unit
448
454
append_token (d + n->unit (), n);
449
455
}
You can’t perform that action at this time.
0 commit comments