Saturday, September 18, 2021

How to install tailwindcss on Ruby on Rails 7

I am trying to install tailwindcss on rails 7. Let's learn how to do it.

Add rails/tailwindscss on the gem file - 

$ gem 'tailwindcss-rails'


After run bundle install. Then run - 

$ ./bin/bundle add tailwindcss-rails

$ ./bin/rails tailwindcss:install



On this part mistakenly I have not written yes (Y) for this reason it was not generating perfectly. You have to remind this. After giving permission it's perfectly generated.

These are the new files changes - 



Now you have to test it. On the view page you can write - 

<button class="bg-indigo-500">

  Save changes

</button>




You can see it's working. You can read more about tailwind css from their official documentation.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.