Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Values are not rounded properly #44

Closed
jednano opened this issue Aug 4, 2015 · 2 comments
Closed

Values are not rounded properly #44

jednano opened this issue Aug 4, 2015 · 2 comments

Comments

@jednano
Copy link

jednano commented Aug 4, 2015

For example, I have a root value of 14px and the following CSS:

.foo {   
    font: 300 1.14286rem/1.28571rem 'Source Sans Pro', Arial, sans-serif;
}

Which transpiles into:

.foo {
    font: 300 16px/17px 'Source Sans Pro', Arial, sans-serif;
}

But 14px * 1.28571 === 17.99994. I would expect 16px/18px instead.

@iamvdo
Copy link
Collaborator

iamvdo commented Aug 13, 2015

It seems a feature: https://github.com/robwierzbowski/node-pixrem/blob/master/spec/pixrem-spec.js#L71-L76

Modifying this will introduce a breaking change, so v2.

What is the best option:

  • round values to the nearest integer
  • don't round values at all and let browsers deal with that (It sounds better to me)

@jednano
Copy link
Author

jednano commented Aug 13, 2015

I think the right thing to do in this case is to expose a unitPrecision option (default: 5) and break the version. My philosophy there is aligned with TJ Holowaychuk, who believes in breaking things fast if it benefits the [software]. Here's an example of unitPrecision in action.

@iamvdo iamvdo closed this as completed in 5dc93d0 Sep 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants