-
Notifications
You must be signed in to change notification settings - Fork 31
feat: enhance CSS parsing and unit handling #32
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
base: master
Are you sure you want to change the base?
Conversation
BobPritchett
commented
Dec 7, 2025
- Added support for additional CSS escape sequences (b, f, j, q, v, w, y) in parse-css.pegjs.
- Updated Length type in style.ts to include new units (cm, mm, Q, in, pc, pt, px, em).
- Refactored resolveEm function to resolveUnit for better unit conversion handling.
- Improved unit conversion logic for various length units in resolveUnit function.
- Added VSCode launch configuration for debugging Vite applications in Chrome and Edge.
- Created VSCode settings to disable format on save and Prettier.
- Added support for additional CSS escape sequences (b, f, j, q, v, w, y) in parse-css.pegjs. - Updated Length type in style.ts to include new units (cm, mm, Q, in, pc, pt, px, em). - Refactored resolveEm function to resolveUnit for better unit conversion handling. - Improved unit conversion logic for various length units in resolveUnit function. - Added VSCode launch configuration for debugging Vite applications in Chrome and Edge. - Created VSCode settings to disable format on save and Prettier.
chearon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The biggest thing is that several tests are failing. I'll figure out how to get the tests to run when your PR is opened. Not sure what the problem is; where you put resolveUnit should be alright.
src/parse-css.pegjs
Outdated
| W = 'w'i / '\\' '0'? '0'? '0'? '0'? [\x57\x77] ('\r\n' / [ \t\r\n\f])? / '\\w'i { return 'w'; } | ||
| X = 'x'i / '\\' '0'? '0'? '0'? '0'? [\x58\x78] ('\r\n' / [ \t\r\n\f])? / '\\x'i { return 'x'; } | ||
| Y = 'y'i / '\\' '0'? '0'? '0'? '0'? [\x59\x79] ('\r\n' / [ \t\r\n\f])? / '\\y'i { return 'y'; } | ||
| Z = 'z'i / '\\' '0'? '0'? '0'? '0'? [\x5A\x7A] ('\r\n' / [ \t\r\n\f])? / '\\z'i { return 'z'; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think most of the additions here are used. Can you remove the other changes, so it just adds Q?
If you look at the pegjs output, this actually does cause dead code to be generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can, but I think it very likely we'll need some/all of them and having it be complete now seemed likely a way to reduce errors in the future. Maybe commenting them out till used?