-
-
Notifications
You must be signed in to change notification settings - Fork 42
Description
I've really been enjoying Dashboards.jl — and am thrilled to see this becoming Dash.jl! I've been brainstorming a bit on how to make the HTML templating a bit simpler (and closer to both HTML & Julia syntaxes). One thought I've had is to de-emphasize (or maybe even deprecate/remove) the do
block form and instead allow passing children as varargs to the components. Since we can pass keyword arguments before positional arguments, we can still have a decent structure.
As an example, DashboardsExamples/dash_tutorial/5_interactive_graphing_1.jl becomes:
html_div(
# ...
html_div(className="three columns",
dcc_markdown(
"""**Hover Data**
Mouse over values in the graph."""
),
html_pre(id="hover-data", style=styles.pre)
),
html_div(className="three columns",
dcc_markdown(
"""**Click Data**
Click on points in the graph."""
),
html_pre(id="click-data", style=styles.pre)
),
# ...
)
The biggest advantage over the do
block form is that it's easier to catch mistakes. Forgetting a comma at the end of a line in a do
block just simply ignores everything that precedes it! It's an error like this. I also think this matches Julia's style a bit closer while still allowing you to put id
s and class
es right up front (like in HTML).