Use Browser Sync with Rails. This gem provides installers to get you going with live reloading and browser syncing โ works beautifully with cssbundling-rails and jsbundling-rails.
Whenever Browser Sync detects changes to any assets or views, it will trigger a browser reload. You can configure Browser Sync via the generated bs-config.js
โ it's preconfigured to inject into head
rather than body
, due to turbo's body replacement.
You must already have node and yarn installed on your system, then:
- Add
browsersyncing-rails
to your Gemfile withgem 'browsersyncing-rails'
- Run
./bin/bundle install
- Run
./bin/rails browsersyncing:install
Just run ./bin/dev
and visit localhost:3001
to access your Rails instance via the Browser Sync proxy, and localhost:3002
to access the Browser Sync UI; Rails runs on localhost:3000
as usual.
Browser Syncing for Rails is released under the MIT License.