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

fix: Don't add units number values used for variables #694

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

nmn
Copy link
Contributor

@nmn nmn commented Sep 24, 2024

fixes #689

For convenience and to match the behaviour of React Native, StyleX allows the usage of numbers as values and tries to automatically add units where they make sense.

The issue, however, is that for any unknown value StyleX assumes it to be a length and adds px unit by default. While we should probably revisit that behaviour itself, for now, this PR adds a special case for CSS variables and leaves numbers used as values for CSS variables keys as is.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 24, 2024
Copy link

workflow: benchmarks/size

Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.

@stylexjs/scripts@0.7.5 size:compare
./size-compare.js /tmp/tmp.Gh8zrY4Y1I /tmp/tmp.XEZolNWkkx

Results Base Patch Ratio
stylex/lib/stylex.js
· compressed 899 899 1.00
· minified 3,223 3,223 1.00
stylex/lib/StyleXSheet.js
· compressed 1,266 1,266 1.00
· minified 3,776 3,776 1.00
rollup-example/.build/bundle.js
· compressed 563,563 563,563 1.00
· minified 10,185,348 10,185,348 1.00
rollup-example/.build/stylex.css
· compressed 100,211 100,211 1.00
· minified 759,868 759,868 1.00

@nmn nmn merged commit 1a18bd5 into main Sep 25, 2024
8 checks passed
@nmn nmn deleted the fix/number-values-for-vars branch September 25, 2024 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using data attributes token conversions break sometimes
3 participants