A guide to configuring htmx globally and per-page in Ruby web applications using Hanami. Covers setting up an htmx provider with secure defaults (disabling script tags, changing default swap style to outerHTML), injecting htmx dependencies into the view context, detecting htmx requests, merging per-page configuration overrides via a content_for helper, and rendering the config via a meta tag in the application layout. Includes RSpec tests for the view context methods.
Sort: