phlex-rails
phlex-rails copied to clipboard
`phlex:install` doesn’t add the Tailwind stylesheet to ApplicationLayout
Even though the generator patches tailwind.config.js
to scan Phlex components, Tailwind classes won’t work until you manually add stylesheet_link_tag “tailwind”
to ApplicationLayout
.
IMO if Phlex already knows you’re using Tailwind, it’s reasonable to expect it to work out-of-the-box. I’d also love to submit a PR for this
Good point! This would be great.
Something I just noticed with the install_generator, it assumes that the Tailwind config lives under config/tailwind.config.js
but by default in a new Rails app this config is just a file in the root of the app named tailwind.config.js
. Would it be better to update that line to be:
TAILWIND_CONFIGURATION_PATH = Rails.root.join("tailwind.config.js")
?
I was wondering why Tailwind classes I was adding were not working when using my Phlex components and was able to track it down to that, my tailwind config wasn't updated when running bin/rails generate phlex:install
@ibarreto I think that’s where the config used to be by default.
The first part of this issue was fixed in #165. Open to pull requests adding the stylesheet link tag to ApplicationLayout
.
I run the initial phlex generator but I got this warning
so my tailwind config file was not updated.
Which are the routes that I need to manually add to the content array?
@luiscobot did you figure this out in the end? If not - this depends on how you installed Tailwind, and ultimately, where your tailwind.config.js
is. If you need further help, let us know (along with those details).
Once #204 lands in main, can you try and report any issues?