Skip to content

Add grails-htmx v8 guide#497

Merged
jamesfredley merged 1 commit intomasterfrom
add-grails-htmx-v8
May 3, 2026
Merged

Add grails-htmx v8 guide#497
jamesfredley merged 1 commit intomasterfrom
add-grails-htmx-v8

Conversation

@jamesfredley
Copy link
Copy Markdown
Contributor

Summary

Adds the HTMX with Grails 8 guide as the fifth Grails 8 sample-app-flavour guide and the second greenfield one (after the Tailwind PR #493). Following PRs #479, #493, #494, #495, #496.

A worked task tracker that demonstrates the HTMX recipe on a Grails 8 GSP backend: server-rendered first paint, then hx-get/post/patch/delete round-trips that swap small GSP partial fragments into well-defined slots in the DOM. No SPA, no JSON, no client-state framework.

Greenfield - no upstream rename

The new grails-guides/grails-htmx repository was created public with grails8 as its default branch. There were no overlapping legacy repos to rename.

What's in the PR

  • conf/guides.yml - new grails-htmx registry entry, alphabetical insertion between grails-google-home and grails-javamelody.
  • guides/grails-htmx/v8/guide/*.adoc - 14 chapters.
  • guides/grails-htmx/v8/snippets/ - vendored Task domain, TaskController (7 actions), UrlMappings, main.gsp layout (with the HTMX 2.x script tag), and three GSP partials (_task.gsp row, _taskRows.gsp list, _taskEdit.gsp edit form).

Upstream sample app

grails-guides/grails-htmx on the grails8 branch contains the standard initial/ + complete/ layout. initial/ is a vanilla Grails 8 web starter. complete/ adds the HTMX-driven task tracker.

Verification

  • ./gradlew validateGuides -PvalidationMode=both returns 86 guides, 0 errors.
  • ./gradlew renderGuide_grails_htmx_8 --rerun-tasks --no-configuration-cache renders all 14 chapter HTML pages, no Unresolved directive errors.

Notes for reviewers

Worked example for HTMX-driven interactive UI on a Grails 8 GSP backend.
A small task tracker with server-rendered initial page, then HTMX-driven
inline editing, live search, toggle, and optimistic delete with confirm.

Sample-app flavour. Greenfield (no upstream rename) - the new
grails-guides/grails-htmx repo was created public on the grails8
default branch.

The 14 chapters walk through:

- Getting Started (whatYouWillBuild, requirements, howto)
- Creating the Application
- The Task Domain Class
- Adding HTMX to the Layout (script tag with SRI hash)
- URL Mappings (explicit method per route)
- The TaskController (7 actions, 6 of which return GSP partials)
- The Initial Page (server-rendered first paint)
- The Row Partial (one template, four call sites)
- Inline Edit With Validation (422 returns the same edit fragment with
  field errors rendered inline)
- Live Search (hx-trigger="keyup changed delay:300ms")
- CSRF With HTMX (htmx:configRequest hook reads token from a meta tag)
- HTMX vs an SPA (when each fits, cross-references the upcoming
  grails-vite-spa guide)

Verified locally:

  ./gradlew validateGuides -PvalidationMode=both
    [validateGuides] mode=both: 86 guide(s) parsed, 0 SKIP-warned, 0 errors

  ./gradlew renderGuide_grails_htmx_8 --rerun-tasks --no-configuration-cache
    Renders all 14 chapter HTML pages, no Unresolved directive errors.

Assisted-by: claude-code:claude-opus-4-7
Copilot AI review requested due to automatic review settings May 3, 2026 19:47
@jamesfredley jamesfredley merged commit cba360a into master May 3, 2026
5 checks passed
@jamesfredley jamesfredley deleted the add-grails-htmx-v8 branch May 3, 2026 20:02
@jamesfredley jamesfredley review requested due to automatic review settings May 3, 2026 20:10
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