Upgrading a Rails App to Tailwind v4 - HYBRD

21-Feb-2025 17
Last week, I upgraded a client’s Rails app to Tailwind v4. I rarely delay upgrading dependencies, but after briefly looking through the release notes on Tailwind v4 when it first came out, I decided I would hold off for a bit on most of my projects. (I also tend to wait a bit on upgrading to a major release to until a few patch releases have come out.) For this modest-sized Rails app, the upgrade took me somewhere between 4-6 hours, mainly because I was struggling to figure out everything that changed, and how best to use the upgrade tool. If your setup is similar to ours, hopefully this will save you some time. This post is going to be most relevant for Rails apps using Tailwind with PostCSS. If you’re using the tailwindcss-rails gem, you should read Rob Zolkos’ post and follow the upgrade section of the gem’s README. But, no matter what your setup, you are going to need to read through the Tailwind Upgrade guide. Maybe even a couple times.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle