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
How to convert tokens to unescaped, usable values? #227
Comments
Another example: Does a hash token have type |
CSSTree tokenizer doesn't produce an object for a token for performance/memory reasons. That's not necessary in most cases. However, it provides some helper functions to decode/encode values for ident, string and url tokens. See Util functions for detail. |
Thank you for that info! Is there any way to collect the information outlined above with CSSTree? This information is needed to correctly parse CSS so I assume it exists somewhere in CSSTree? |
Another method is passing the output from css-tree to something like lightningcss. Works well! |
I am sure it does, I can also pass it to one of the parsing utilities I've created in But for users this doesn't make sense.
It tokenizes in the same minimal way as csstree but it also exposes a Having such a function in csstree would be useful. |
css-tree/tokenizer
exposes tokens as[type, start, end]
.But it does not seem to expose unescaped and usable values.
For example :
https://www.w3.org/TR/css-syntax-3/#consume-numeric-token
A
dimension-token
should have a value, a unit and a type flag.10px
:10\70 x
:Are there helper functions for this?
The text was updated successfully, but these errors were encountered: