2 ms·
We use this[1] little package, which enables chaining together HTMX responses that can be based on an HTML template file, an HTML raw string, or plain text. All
by sethops1 3mo ago
We use this[1] little package, which enables chaining together HTMX responses that can be based on an HTML template file, an HTML raw string, or plain text. All but the first being OOB targets. Real example:
return htmx.Write(w,
&htmx.Template{
FS: htmx.FS(ui.HTMX, "parts"),
Filename: "arrows.html",
Fields: []any{thread, up},
},
&htmx.Component{
HTML: `
<div {{$count := index . 0 -}} {{- $thread := index . 1 -}}
hx-swap-oob=true
id="points-{{$thread}}"
class="points">{{$count}} points</div>`,
Fields: []any{count, thread},
},
)
[1] https://github.com/cattlecloud/webtools/tree/main/htmx https://github.com/cattlecloud/webtools/tree/main/htmx
- deleted 3mo ago[deleted]