I wanted to test the new integration of Tailwind CSS with Rails 7, just wrote a bit of code to see how this works… Normally, whenever the views are modified, the bundler should regenerate the CSS… but it does not. I need to stop the server (./bin/dev) and restart the server to see my changes. Any idea why?
To reproduce it
rails new tailwind --force --javascript=esbuild --css=tailwind
cd tailwind/
rails db:create
rails db:migrate
rails g controller demo show
./bin/dev
Access localhost:3000/demo/show
Then just modify the view demo/show.html.erb to use Tailwind css
e.g.
So I figured it out. I ran the command rake assets:precomile locally for some reason. Likely was just following some guide to setup things. This created a bunch of files in my “/public/assets” folder. After I deleted all the files in that folder things went back to normal. Hope this saves someone else!
Currently, I’m doing each tailwind update this alias rtbap=“rails tailwindcss:build & rails assets:precompile”
if not you don’t see any new simple added text-teal-600 class in a html.erb file
The initial size of builds/tailwind.css 15Kb is passing quickly to +100Kb for a small website app.