Closed skaeneman closed 2 years ago
The cssbundling gem with Tailwind doesn't do much of itself. Did you follow the steps on the Getting set up guide? Based on your package.json, you are likely also interesting in the using your own JS guide.
If you have a JS file named application.js
and any of the JS has CSS, esbuild will output an application.css
. This will overwrite the one generated by tailwind.
https://esbuild.github.io/content-types/#css-from-js
https:/github.com/rails/jsbundling-rails#why -does-esbuild-overvwrite-my-applicationcss
Steps to reproduce
rails new my_app -j esbuild --css tailwind --database=postgresql
cd my_app
bin/dev
in my gemfile both jsbundling-rails and cssbundling-rails were added.
in package.json I see Tailwind added
When I add any Tailwind UI component that requires JavaScript it does not work. For example, adding the HTML for the "simple dropdown" here https://tailwindui.com/components/application-ui/elements/dropdowns
Adding other Tailwind elements to a page works correctly, however, anything that requires JavaScript is not rendering correctly.
Expected behavior The dropdown should open or close normally
Actual behavior The dropdown is expanded on the page and does not close/open when the button is toggled.
System configuration Rails version: Rails (7.0.0) node: 16.5.0 npm: 8.3.0 yarn 1.22.10 TailwindCSS 3.0.7
Ruby version: 3.0.1