How to install TailwindCSS 2 on Rails 6

10-Dec-2020 1793
TailwindCSS v2.0 was released on 19 November 2020 πŸŽ‰, but it had a few changes that requires some tweak to install and use it on Rails 6, such as the requirement of PostCSS 8 and Webpack 5. As of current (10 December 2020), Rails 6 comes with webpack 4 and PostCSS 7, which doesn’t match the requirement of TailwindCSS v2.If we install TailwindCSS v2 directly on a Rails 6 app using yarn add tailwindcss, we might get a error (PostCSS plugin tailwindcss requires PostCSS 8) like this when running the server :.
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