Import Maps

Before I get to the Hotwire version of the React page, I first swapped out jsbundling-rails and cssbundling-rails for importmaps-rails and the tailwindcss-rails gems. This was a little bit more straightforward than I expected, especially because the app is small, and I didn’t need to bring in React (since this version of the app will replace it).

Here’s what I did:

  • I removed cssbundling-rails and jsbundling-rails from the Gemfile and added importmaps-rails and tailwindcss-rails.

  • I removed the js: and css: lines from the Procfile.

  • I removed the files from the app/assets/builds directory; those will interfere with the import map if present and will lead to some very hard to find bugs because the code you are writing isn’t the ...

Get Modern Front-End Development for Rails, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.