-
Notifications
You must be signed in to change notification settings - Fork 312
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
chore: Add new style-value-parser package #743
Open
nmn
wants to merge
13
commits into
main
Choose a base branch
from
chore/css-value-parser
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Oct 11, 2024
workflow: benchmarks/sizeComparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
|
nmn
force-pushed
the
chore/css-value-parser
branch
from
October 17, 2024 22:01
0a83c00
to
4b70761
Compare
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
We're currently using
postcss-value-parser
for a few purposes but it is quite rudimentary.lightningcss
was considered but its API only parses entire CSS files and not individual values. It would also be a very heavy tool for what we need as it's an entire CSS post-processor. It would also allow all valid CSS and it would be more difficult to manually add our own constraints to it.New CSS Value Parser
This PR introduces a new parser which have been tailored for StyleX:
box-shadow
..toString()
methods will output normalised strings for various valuescm
andinch
topx
.How it will be used
This parser will be used to :
@media
queries in order to add additional guarantees for them.How complete is it?
There should already be parser for every CSS type.
There are a few style property specific parsers that composing together the "type" parsers. These are there as examples to get us started. These need to be updated to allow CSS variables being used in various positions.
There are many unit tests, but test coverage could be improved. Specially for the
toString
methods.