Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Modify parsed CSS? #11

Open
stodge opened this issue Jul 15, 2016 · 1 comment
Open

Modify parsed CSS? #11

stodge opened this issue Jul 15, 2016 · 1 comment

Comments

@stodge
Copy link

stodge commented Jul 15, 2016

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

@SimonSapin
Copy link
Member

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants