talira

Hotwire Spark

Live reloading for Hotwire applications

open sourceMITself-hostablefree

Hotwire Spark is a development gem that reloads a Rails app's page smoothly when its source changes. On an HTML change it morphs the page's body into the new one and reconnects Stimulus controllers; on a CSS change it reloads only the stylesheets; on a Stimulus controller change it swaps that controller's module and reconnects. It works with import maps or a JavaScript bundler, and installing it is adding the gem to the development group. 37signals made it for Hotwire apps.

Problems it solves

  • see my Rails view changes in the browser without pressing reload every time
  • live reload in development that doesn't flash the whole page or lose my place
  • reload only the CSS when I edit a stylesheet
  • pick up changes to a Stimulus controller without a full page refresh

Features

  • morphs the page body on HTML changes
  • reloads stylesheets on CSS changes
  • replaces changed Stimulus controllers
  • works with import maps and JavaScript bundlers
  • configurable monitored paths