question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add optional rounding for more than just `px` values

See original GitHub issue

When using Stylus to calculate lots of em, remand % values one ends up with tons of ridiculously precise (15 digit decimal fractions) numbers.

Clean-css should also allow me to cap the precision of these values – independently of the --rounding--precision option which only applies to px values.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jakubpawlowiczcommented, Dec 19, 2016

Sure, I actually read pt there 😉

Re setting desired precision, how about sth like { '*': 3, px: 6 } or *:3,px:6 means 3 is default for all units while 6 is for px?

0reactions
jakubpawlowiczcommented, Dec 21, 2016

Thanks @maranomynet for checking. I’ll push it to master and if anything is missing before we can still adjust it before 4.0 release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Round a number to the decimal places I want - Microsoft Support
In the Decimal places box, enter the number of decimal places that you want to display. By using a function in a formula:...
Read more >
How to round up/down an pixel value of a raster to a pixel ...
Multiply your float raster by 100, add 0.5, run Int, and divide by 100 to round to the nearest hundredth. For example, if...
Read more >
css calc - round down with two decimal cases - Stack Overflow
In CSS Values and Units Module Level 4, you can round your number or dimension however you want with the round() CSS function....
Read more >
10 + 1 Ways on How to Round Numbers in Excel
You can round a number to the right or left of the decimal point. ... Specifying the number of digits to truncate to...
Read more >
Rounding and truncating numbers in JavaScript
Once example can be when needing to drop decimal places from a pixel value to avoid anti aliasing or weird pixel rounding which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found