You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I'm digging into this library for the first time and am trying to parse a stylesheet, in order to pull all font-family/ font-face declarations out of it. I've found that to be rather difficult - when working with a stylesheet instance, I have to call getAllStyleRules, getAllMediaRules, etc. etc., and iterate my way through many layers.
Is there any way to do this easier, without requiring so many manual calls? I would use getAllRules but that returns a very generic rule instance (ICSSTopLevelRule), and I'm trying to avoid having a large if statement chain within my code to check for relevant class instances, just to retrieve child declarations.
The text was updated successfully, but these errors were encountered:
You may want to have a look at class CSSVisitor.
Call visitCSS using the parsed CascadingStyleSheet and as visitor use a class derived from DefaultCSSVisitor.
Overload onDeclaration and check for font-family or whatever you need.
hth
Hello. I'm digging into this library for the first time and am trying to parse a stylesheet, in order to pull all
font-family
/font-face
declarations out of it. I've found that to be rather difficult - when working with a stylesheet instance, I have to callgetAllStyleRules
,getAllMediaRules
, etc. etc., and iterate my way through many layers.Is there any way to do this easier, without requiring so many manual calls? I would use
getAllRules
but that returns a very generic rule instance (ICSSTopLevelRule
), and I'm trying to avoid having a large if statement chain within my code to check for relevant class instances, just to retrieve child declarations.The text was updated successfully, but these errors were encountered: