How to Fix Tailwind CSS Not Loading in Rails 7

I recently started a new Rails app. I knew right off the bat I wanted to use Tailwind, and since I was using Rails 7, I specified that when I created the app with:

rails new app-name --css tailwind

Then I got to work making my views and adding styles. When I started the app with rails s I noticed none of the styles loaded. You can quickly fix this by running the following before you run rails s

rails tailwindcss:build 

This is annoying though, because you’ll have to run it anytime you include a new class. You can instead start your rails server with this command for hot reloading:


Hope this helps!