Rails 7.1.3.2 app, not using Node (and ideally don’t want to have to). I built whilst using the tailwindcss CDN and the DaisyUI CDN, both listed in the head of my application.html.erb:
<!-- <script src="https://cdn.tailwindcss.com"></script> -->
(uses TailwindCSS v.3.4.5)
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css" rel="stylesheet" type="text/css" />
(uses DaisyUI v.4.12.10)
In prep for production deployment, removing the Tailwindcss CDN script tag from application.html.erb and moving to the tailwindcss-rails gem (v.2.6.2 (the one that matches TailwindCSS 3.4.5)). Running:
bundle update tailwindcss-rails
bundle install
bundle tailwindcss:install
bin/rails assets:clobber
bin/rails assets:precompile
,
I now have various styling elements that break:
<hr>
default styling changes and explicit TailwindCSS utility classes / application.tailwind.css component @apply rules or important statements fail to style the elements.<hr class="my-2">
- DaisyUI dropdown elements’ utility class explicitly defined widths get lost, e.g.
<details class="conversations-dropdown dropdown dropdown-end w-11 h-11 mr-2 flex justify-center items-center">
. - DaisyUI card elements’ utility class applied positioning no longer has any effect;
<div class="card w-96 bg-base-100 fixed right-8 bottom-8">
I uncomment the TailwindCSS CDN and styling is all fine, I comment it out and the above listed elements, and perhaps others that I haven’t found, breaks.
Relevant code extracts:
application.html.erb
<!-- <script src="https://cdn.tailwindcss.com"></script> --><!--styling lost with this commented-->
<%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css" rel="stylesheet" type="text/css" />
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
gemfile.rb
gem "tailwindcss-rails", '~> 2.6.2'
gemfile.lock
tailwindcss-rails (2.6.2)
railties (>= 7.0.0)
tailwindcss-rails (2.6.2-aarch64-linux)
railties (>= 7.0.0)
tailwindcss-rails (2.6.2-arm-linux)
railties (>= 7.0.0)
tailwindcss-rails (2.6.2-arm64-darwin)
railties (>= 7.0.0)
tailwindcss-rails (2.6.2-x86_64-darwin)
railties (>= 7.0.0)
tailwindcss-rails (2.6.2-x86_64-linux)
railties (>= 7.0.0)
The tailwindcss-rails gem version page here for tailwindcss 3.4.5 matching version.
Anybody got any idea what I’m doing wrong and how to solve?