parcel-bundler / parcel-bundler/lightningcss

Option to not add units of measure

Open
#682 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
7.7k
Forks
302
PR merge metrics
No merged PRs in 30d

Description

Currently

a{width:1}

becomes

a{width:1px}

which breaks my UI by turning invalid CSS into a valid one.

(Of course the right thing to do is to fix my origin code to not contain invalid CSS. But in a large project that may take a while and hurt the adoption of LightningCSS.)

I think in this case the correct behavior would be to drop the property completely as its value is incorrect.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

In the Rust CSS parser/transformer, locate the logic that adds px units to unitless values and any tests covering width declarations. First run the relevant existing test suite, then determine where an option can control this behavior. Done means the option prevents invalid unitless declarations from becoming valid CSS and has coverage for the reported example.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, rust
Domain
compilers, frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.