Nate Roise

Joined

1,030 Experience
10 Lessons Completed
0 Questions Solved

Activity

This may have been true at one time, but having them in Chris' order is fine:
plugins: [
require('tailwindcss'),
require('autoprefixer'),
require('postcss-import'),
...

Actually, after further testing I'm certain reinstalling Webpacker fixed it. (The config file had nothing to do with getting TailwindCSS working.)

To get this working on an existing app running Rails 6, I had to:

1) Create a tailwind.config.js file using yarn tailwindcss init and move it from the root to app/javascript/stylesheets
The official TailwindCSS documentation says this file is optional, but I couldn't get any default browser styles to change until I did this.
If you want the full TailwindCSS default theme, use yarn tailwindcss init --full. You can strip unused extras out on your production server with Purge-CSS later if you want.

2) Reinstall Webpacker. When I ran bin/webpack I got this error: "bin/webpack: No such file or directory".
bundle exec rake webpacker:install fixed it.

Config: Ruby 2.6.5 + Rails 6.0.3 + TailwindCSS 1.4.6

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.