tinycss
tinycss copied to clipboard
Modify parsed CSS?
While parsing a CSS file I'd like to convert any colours from "white" or "#FFF" to "#FFFFFF". I tried modifying the token's value accordingly but calling as_css() doesn't appear to show the change. Is it possible at all to modify the parsed CSS?
Thanks
tinycss doesn’t actually have a serializer. Its as_css method only returns a slice of the original CSS input, which is stored in Token._as_css.
I suggest trying https://github.com/SimonSapin/tinycss2 which does have a proper serializer.