-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure decimal places #34
Comments
Hey @MichaelBrunn3r, thanks for reaching out! I'm trying to wrap my head around your problem, but I don't really seem to get it. Could you give me an example of a tailwind class that uses spacing (like |
With the default base font size: .gap-2 {
gap: 0.5rem;
} With a base font size set to .gap-2 {
gap: 0.5714285714285714rem;
}
This not a bug, just a request to reduce file size |
I see what you mean. The issue here is that browsers handle rounding for fractional values differently. Some browsers just "cut off" decimal values, others round up or down to the nearest integer. Therefore, if we would add an option to limit the number of decimal places, we could actually see a difference between the "full" value with all decimal places and a "stripped" value with fewer decimal places. Although, we could add the option with a disclaimer and it's up to the user to decide, if the tradeoff is relevant for their use case. What do you think? |
That sounds like a very good idea and would solve my issue. As you say, I don't think it should be a default. Having the full precision is important to prevent unexpected behaviour. Users should decide on their own when to round the values and be warned of the downsides. |
I will consider the option to configure the number of decimal places for the next release of this package and keep you updated on the changes in this thread. Thanks again for the input! |
Hi,
just found your package. Thx for fixing my exact niche problem :).
I have to use this plugin because I work in an environment where I can't control the root font-size, which is set to 14px.
The only remaining issue for me is the rounding. E.g.
*-3
(=16px) gets converted to0.8571428571428571rem
. I don't realy need that many decimal places.Would it be possible to add a cofiguration option for the maximum amount of decimal places?
The text was updated successfully, but these errors were encountered: