Htmx 4.0(four.htmx.org)
815 points by rmsaksida 13 days ago | 229 comments
tl;dr: htmx 4.0 ships after 8 months of work, with internals migrated from XMLHttpRequest to fetch(). Breaking changes include explicit attribute inheritance (via `:inherited` suffix), standardized event names (e.g., `htmx:before:request`), and history navigation via re-fetching instead of localStorage snapshots. New features include built-in morph swaps (idiomorph), an `<hx-partial>` tag for multi-target updates, streaming extensions (SSE, WebSockets, multipart), and `hx-live` for front-end scripting. A CLI upgrade tool is provided; htmx 2 remains the NPM `latest` tag until 2027.
HN Discussion:
  • Long-time htmx fans expressing enthusiasm and gratitude for the library and new release
  • Htmx works great for progressive enhancement and simple stacks like Go+SQLite
  • Htmx is problematic because it forces mixing presentation with business logic, unsuitable for SPA-style development
  • ~Alternative libraries like alpine-ajax may be smaller and sufficient replacements for htmx
  • Appreciation for the clarity of htmx's machine-oriented documentation compared to typical human docs