palkan / view_component-contrib

A collection of extension and developer tools for ViewComponent
MIT License
369 stars 22 forks source link

Automatically set up TailwindCSS paths if Rails project is bootstrapped with Tailwind #31

Closed Morozzzko closed 1 year ago

Morozzzko commented 1 year ago

Is your feature request related to a problem? Please describe.

My project uses Tailwind. Generated with --css=tailwind option.

I'm also a heavy user of tailwindui.com, so naturally I wrap TailwindUI components into View Components

However, a fresh install of view_components-contrib makes it clear that no styles are going to be compiled by bin/rails tailwindcss:watch just because Tailwind doesn't know about those paths

Describe the solution you'd like

By default, config/tailwind.config.js contains those lines:

  content: [
    './public/*.html',
    './app/helpers/**/*.rb',
    './app/javascript/**/*.js',
    './app/views/**/*.{erb,haml,html,slim}'
  ],

We might just go ahead and add app/frontend/components

  content: [
    './public/*.html',
    './app/helpers/**/*.rb',
    './app/javascript/**/*.js',    
    './app/frontend/components/**/*.{erb,haml,html,slim}',
    './app/views/**/*.{erb,haml,html,slim}'
  ],

voilà, problem solved

Describe alternatives you've considered

It might be OK to just add this to readme instead of automating this as a feature

Additional context

None

palkan commented 1 year ago

Thanks for the configuration examples. For now, we collect non-Webpack configuration in the discussion. Added a link to the issue there.