cssutils
cssutils copied to clipboard
@support selectors results into an UNKNOWN_RULE
Would it be possible to support the @support selector please?
Many Thanks in advance
Thanks for the request. This project doesn't have active implementers, but it will welcome contributors with open arms.
@jaraco contributing @support selector is beyond my scope. Still I have a question:
- @support rule.type appears as UNKNOWN_RULE
- inside that unknown rule I change all colors with string based functions
- so I end up with a string of a new @support rule
- is there a way to replace the original UNKNOWN_RULE with the new string I created?
/* UNKNOWN_RULE */
@supports (-webkit-text-stroke: thin) {
. gradient-color {
background: linear-gradient(to right, #60c7f2 0%, #00a5e6 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text
}
}
shall be replaced with
@supports (-webkit-text-stroke: thin) {
. gradient-color {
background: linear-gradient(to right, rgba(96,199,242,1) 0%, rgba(0,165,230,1) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text
}
}
How to achieve this?´
The main loop has this form:
for rule in sheet.cssRules:
if rule.type in [cssutils.css.CSSRule.UNKNOWN_RULE]:
rule.style = my_new_string
@johanjohan I'm afraid I don't have enough expertise to provide a good answer. The best I can recommend is to experiment and inspect the code and devise a hack or workable solution.