feat: enhance CSS parsing and unit handling - #32
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.
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.
Uh oh!
There was an error while loading. Please reload this page.
| 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.
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.
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?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.