Reputation: 2941
I'm working on a Rails 7 project where I use ViewComponents and Tailwindcss. I'm having some problem getting changes in component's .html.erb
files to update properly.
When I run ./bin/dev
and make css-changes or additions inside app/components/<module-name>/<file-name.html.erb
the added css class doesn't get compiled / rendered.
If I would add the same class in any of my app/views
html.erb
the correct styling is applied.
I have tried to update config/tailwind.config.js
to include:
content: [
...
'./app/views/**/*',
'./app/components/**/*'
But every time I re-run .bin/dev
the css-classes that only exists inside app/components
won't show.
Any ideas on how I can fix this?
Upvotes: 2
Views: 2080
Reputation: 61
I'm working with
gem 'view_component'
Based on what you did, I also updated my config/tailwind.config.js
with the following and it worked for me with the following code:
content: [
'./public/*.html',
'./app/helpers/**/*.rb',
'./app/javascript/**/*.js',
'./app/views/**/*.{erb,haml,html,slim}',
'./app/components/**/*.{erb,haml,html,slim}' // I Add this line
],
Upvotes: 4