Add optional rounding for more than just `px` values
See original GitHub issueWhen using Stylus to calculate lots of em
, rem
and %
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:
- Created 8 years ago
- Comments:13 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 forpx
?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.