refactor: move document head includes out of via configuration into their own append funcs; update examples

This commit is contained in:
Joao Goncalves
2025-11-09 03:17:03 -01:00
parent 5c80a934e9
commit 9f9e4eb568
7 changed files with 72 additions and 90 deletions

View File

@@ -10,13 +10,9 @@ type Counter struct{ Count int }
func main() {
v := via.New()
LiveReloadPlugin(v)
v.Config(via.Options{
DocumentTitle: "Live Reload",
DocumentHeadIncludes: []h.H{
liveReloadScript(),
},
Plugins: []via.Plugin{LiveReloadPlugin},
})
v.Page("/", func(c *via.Context) {
@@ -29,7 +25,7 @@ func main() {
})
c.View(func() h.H {
return h.Div(h.Class("container"),
return h.Div(
h.H1(h.Text("Live Reload")),
h.P(h.Textf("Count: %d", data.Count)),
h.P(h.Span(h.Text("Step: ")), h.Span(step.Text())),