IDOM "Wait For" CSS #723
Replies: 2 comments 8 replies
-
I'd like to avoid doing anything custom with HTML attributes. Rather it would probably be easier to add an option when configuring apps for a URL where IDOM should load CSS from: @app.route("/static/styles.css")
async def styles():
...
configure(app, Component, Options(css_url="/static/styles.css") Another option would be to implement some HTML templating to the client in order to inject arbitrary HTML into the header: configure(
app,
Component,
Options(head_html="<title>My App</title><link ... />")
) Or even better, configure(
app,
Component,
Options(head_html=[html.title("My App"), html.link(...)])
) |
Beta Was this translation helpful? Give feedback.
-
I'm not really sure how we'd implement this. Typicaly solutions for conditionally loading CSS don't ever block so you can't just wait for the CSS to load before rendering the rest of the page. |
Beta Was this translation helpful? Give feedback.
-
Opening as a discussion first to check for feasibility. Should be pursued in V2 if feasible.
Ideally, I'd like to defer some CSS loading to be on-demand. This is especially important for Conreq, where there will be tons of user-generated CSS that won't be needed except with specific components. With the current options available to me within IDOM, the HTML often loads prior to the CSS, which causes visual jank.
Note: The
rel=preload
HTML attribute doesn't achieve the same goal here.The only cross-framework implementation I could think of is: For developers using CSS URLs, create some kind of mechanism within IDOM that will attempt to fetch the CSS URL prior to rendering the component body.
Beta Was this translation helpful? Give feedback.
All reactions