rails / tailwindcss-rails

MIT License
1.39k stars 171 forks source link

Use of gem without sprockets (eg vite) aka standalone use of tailwind generators #367

Open synth opened 4 months ago

synth commented 4 months ago

I'd like to use this gem primarily for the scaffolding generators. When the gem is included, I get the following error:

undefined method `assets' for an instance of Rails::Application::Configuration

This takes us to here: https://github.com/rails/tailwindcss-rails/blob/5c73dec4e38c9bd1664a530ecb66e938aaa4a3d0/lib/tailwindcss/engine.rb#L5-L7

My understanding is that Rails.application.config.assets is Sprockets specific. If I comment out this line, the generators work fine. Is there a way to explicitly opt out of this line/initializer or would this be considered a bug, perhaps? This seems to be the only sprockets specific reference, although I'm not too sure. Other things probably don't work in a vite context since assets go in app/frontend typically with Vite. Although, again, in my case, all I'm after is the generators :)

flavorjones commented 4 months ago

Related: https://github.com/rails/tailwindcss-rails/discussions/353