Skip to content
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

Option to not add units of measure #682

Open
stoyan opened this issue Feb 26, 2024 · 1 comment
Open

Option to not add units of measure #682

stoyan opened this issue Feb 26, 2024 · 1 comment

Comments

@stoyan
Copy link

stoyan commented Feb 26, 2024

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.

@devongovett
Copy link
Member

Lightning CSS is a bit lenient here to support quirks mode, where unitless lengths are supported in some properties: https://drafts.csswg.org/css-values-4/#deprecated-quirky-length. Perhaps there should be an option to make this more strict, as mentioned in the code here:

Token::Number { value, .. } => {
// TODO: quirks mode only?
Ok(LengthValue::Px(value))
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants