Live previews with Rails and Stimulus 2

Who wouldn’t want a live preview for writing their great content? If you happen to be running Rails with Hotwire, it’s surprisingly easy with a small Stimulus controller.Based on the feedback to this post (primarily thanks to edwinvlieg from HN), I decided to include a solution using Turbo as well. So the first example uses a regular AJAX with Rails UJS and then we change it to a Turbo Frame.
Live previews with Rails and Stimulus 2 #ruby #rubydeveloper #rubyonrails #live #stimulus https://rubyonrails.ba/single/live-previews-with-rails-and-stimulus-2

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles