Skip to content

Compare: templ → gsx migration of examples#30

Open
jackielii wants to merge 13 commits into
examples-templfrom
examples-gsx
Open

Compare: templ → gsx migration of examples#30
jackielii wants to merge 13 commits into
examples-templfrom
examples-gsx

Conversation

@jackielii

Copy link
Copy Markdown
Owner

Side-by-side comparison of the structpages examples written in templ (base branch) vs gsx (this branch). This is a review/comparison artifact, not for merge — it shows the authoring difference between the two templating approaches.

Scope

  • Source files only (.templ.gsx). Generated files (*_templ.go, *.x.go) are omitted on both sides so the diff is the hand-written authoring experience, not machine output.
  • Isolated to examples/ — all library/.go code is identical on both branches, so it does not appear in the diff.
  • Files that stayed structurally close render as renames ({pages.templ => pages.gsx}); ones that were reworked show as paired add/delete.

What to look at

  • Conciseness: 762 insertions vs 952 deletions across 16 example components — gsx is ~20% less source for the same UI.
  • blog/blog/components.templ has no gsx counterpart: the gsx rewrite consolidated those shared primitives into blog/ui/components (one-way dependency: features → ui).
  • Ergonomics on display: author-owned *Props structs (no generated <Name>Props), Attrs fallthrough on components, kebab-named HTMX targets, nullary Page() methods on route receivers.

Caveats

  • Neither branch builds as-is (generated files intentionally omitted, and templ↔gsx imports differ). The real, building gsx version lives on main.

Comment thread examples/blog/admin/posts.gsx Outdated
Comment thread examples/todo/pages.gsx Outdated
jackielii added 12 commits June 25, 2026 17:30
…lter

Rewrite the gsx examples to use gsx pipeline filters instead of ctx-threading
structpages.URLFor/ID/IDTarget calls. Each example wires url/id/target via a
cmd/gen generator (gen.WithFilter), regenerated .x.go included. Full working
examples (build green), comparing against the templ baseline (PR base).
… body param

A custom-body wrapper component should ride the built-in Children prop rather
than declaring a bespoke body gsx.Node param. Drop the param, use {children} in
the body; the Go caller passes AdminShellWithProps{…, Children: body}.
… package, not a binary

`examples/blog/blog` (no trailing slash) matched the blog feature SOURCE
directory, forcing its files to be force-added. The blog example is run via
`go run .` and can't even build a `blog` binary there (the name collides with
the source subdir), so there is no binary to ignore — remove the line.
Match the renamed gsx config schema (gsx [aliases] -> [filters]). Also fix the
stale 'go tool gsx' comment to 'gsx generate .' (the tool directive was removed).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant