parcel-bundler / parcel-bundler/lightningcss
lightningcss ate my precision
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7.7k
- Forks
- 302
- PR merge metrics
- No merged PRs in 30d
Description
I have a line-height which I have defined as
line-height: calc(4 / 3);
sass (annoyingly) turns this to
line-height: 1.3333333333;
Lightningcss compiles this to
line-height: 1.33333;
With a font-size of 12px, chrome's dev-tools reports this as a line-height of 16px.
However, the computed layout reports an element height of 15.984px. This results in a 1px upshift of content meaning it appears uncentered.
Adding another two digits of precision fixes the issue, but ideally I would like some option to be able to specify the precision of floats.
See also #917
How it should look:
How it does look:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported line-height case with calc(4 / 3) and compare Lightning CSS output with the layout result at a 12px font size. Read the discussion in #917 for related context. No source files or tests are named; done means defining and implementing a suitable float-precision option, with coverage for the reported precision-sensitive output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, rust
- Domain
- compilers, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100