Tailwind Classes not compiled using ViewComponents Rails

425 Views Asked by At

I can use Images in post if you want read all post with images go to github issues https://github.com/rails/tailwindcss-rails/issues/201

I have been testing ViewComponts and I found this ViewComponts + Tailiwnd guide.

Example The guide uses a CDN to use tailwind and everything works fine.

My problem is that using tailwindcss-rails the tailwind classes that are injected from a component are not rendered in the view.

I start server from Procfile

Error:

Classes are loaded in Html but not in css

I know where the error is but I can't find a solution without having to use a tailwind CDN.

PD: I have also used rails assets:clobber

1

There are 1 best solutions below

0
Felipe dos Anjos On BEST ANSWER

Make sure to add the components folder in the paths array to Tailwind config

config/tailwind.config.js
module.exports = {
  content: [
    './public/*.html',
    './app/helpers/**/*.rb',
    './app/javascript/**/*.js',
    './app/views/**/*.{erb,haml,html,slim}',
    './app/components/**/*' //This is the new Entry
  ],

...