Styling right now consists of manually writing style() tags or loading CSS files. I think there could be a better way that this is done. I have a number of ideas on how this could be done, all of which could be implemented.
Improvement Request Example API
Dataclass-like API
from view import body, Style
class MyStyle(Style, cls="my_class"):
font_family = ["sans-serif"]
body(style=MyStyle)
body(cls="my_class")
CSS Loading API
from view import body, css
body(style=css("index.css"))
Object API
from view import styled, body
my_class = styled(font_family=["sans-serif"])
body(style=styled(font_family=["sans-serif"]))
body(cls=my_class) # perhaps some magic could be done to make it accessible via cls="my_class" (not a variable reference)
Improvement Description
Styling right now consists of manually writing
style()
tags or loading CSS files. I think there could be a better way that this is done. I have a number of ideas on how this could be done, all of which could be implemented.Improvement Request Example API
Dataclass-like API
CSS Loading API
Object API
Anything else?
Waiting on #12, of course.