Installation
Setting up Tailwind CSS in Ruby on Rails v7+ project.
Start by creating a new Rails project if you don't have one set up already. The most common approach is to use the Rails Command Line.
rails new my-projectcd my-projectInstall the tailwindcss-ruby and tailwindcss-rails gems, and then run the install command to set up Tailwind CSS in your project.
./bin/bundle add tailwindcss-ruby./bin/bundle add tailwindcss-rails./bin/rails tailwindcss:installAdd an @import that imports Tailwind CSS to your application.tailwind.css file located in the ./app/assets/stylesheets directory.
@import "tailwindcss";Run your build process with ./bin/dev.
./bin/devStart using Tailwind's utility classes to style your content.
<h1 class="text-3xl font-bold underline"> Hello world!</h1>