search css file by selector-string/prelude-string
a wrapped APIs for tinycss2
pip3 install tytycss
click to see example
css = tyty.CSS(input=input)
2. load all css rules from a .css file
css = tyty.CSS(fn="tst1.css")
3. display
css.count
r = css[2]
r.atkey
r.show_css()
r.prelude
r.head
r.show_content()
4. search in loose mode
default is loose
find all rules whose selectors-path includes 'ul'
rs = css.all("ul")
5. search in strict mode
find all rules whose selectors-path equals ".maincontent"
rs = css.all(".maincontent",mode="strict")
r = css.first("ul")
r = css.last("ul")
r = css.which("ul",8)
r = css.first("ul")
r = css.last("ul")
r = css.which("ul",8)
tyty.beautify_selpath("a . test #oo")
formatted = tyty.beautify_rule(input)
10. beautify file
tyty.beautify_cssfile("tst1.css","tst1.fmt.css")
11. show as dict
r.show()
12. level show
#display at (depth,breadth),
r.mshow(0,0)
# circlely show level by level
r.more()
r.more()
13. list show
r.lshow_prelude()
r.lshow_content()
r.lshow_css()
from xdict.jprint import pobj
pobj(r.dict)
pobj(r.dict,fixed_indent=True)
15. internal_description mat show
pobj(r.mat)
tinycss2
xdict
elist
edict
tlist
estring
1. improve performance
2. deep search