Closed gacharles23 closed 7 months ago
Figured out the problem. I had overlooked the following line in the Flowbite documentation: You can also run rails tailwindcss:build to compile Tailwind CSS.
Once I added that to the production script, it works as expected.
Describe the bug Following the Flowbite Rails guide works just fine in development. But when trying to deploy to Render, the following error is displayed:
ActionView::Template::Error (The asset "tailwind.css" is not present in the asset pipeline.
This error persists for any "flavor" of Turbo load: importmap, esbuilt, and even standard js (no turbo).
To Reproduce Steps to reproduce the behavior:
Create a new rails app. Create a basic controller and an index view, update root route accordingly. Then, follow steps from the Flowbite Rails guide ...
bundle add tailwindcss-rails
rails tailwindcss:install
tailwind.config.js
andapplication.tailwind.css
per the docpin "flowbite", to: "https://cdnjs.cloudflare.com/ajax/libs/flowbite/2.2.0/flowbite.turbo.min.js"
to importmap.rbimport 'flowbite'
to application.jsbundle install; bundle exec rake assets:precompile; bundle exec rake assets:clean;
)Expected behavior App loads properly on a Render server without the "missing Tailwind" error.
**Rails / Ruby versions
Additional context As noted, everything runs fine in development, so there is something going on in the production compile flow. There are a few hacks to workaround the issue, none of which are ideal for long-term production use, including setting
config.assets.compile = true
in production.rb.