Add Tailwind CSS to a Rails app
06-Apr-2021 1453
In this post, I walk through a minimal set of necessary steps to get Tailwind CSS v2 working with Webpacker in a Rails 6.1 app.I read several posts on the topic and each was incomplete. This is what worked for me.AssumptionsYou already have a Rails 6 app created and running locally. It is configured to run Webpacker.If those things aren't true, you'll need to get those in place for the rest of this post to make sense.Install TailwindYou'll need to install Tailwind as well as PostCSS and Autoprefixer. Webpacker is tied to PostCSS v7, so you'll need to install a compat version of Tailwind. The PostCSS and Autoprefixier versions will need to be tied back as well.Use yarn (or npm) from the base directory of your Rails project to install these dependencies:.
Add Tailwind CSS to a Rails app #ruby #rubydeveloper #rubyonrails #Tailwind #Rails #css #tailwind https://rubyonrails.ba/link/add-tailwind-css-to-a-rails-app