phlex-rails icon indicating copy to clipboard operation
phlex-rails copied to clipboard

`phlex:install` doesn’t add the Tailwind stylesheet to ApplicationLayout

Open ariel-codes opened this issue 1 year ago • 5 comments

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

ariel-codes avatar Jan 19 '24 01:01 ariel-codes

Good point! This would be great.

joeldrapper avatar Jan 19 '24 07:01 joeldrapper

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 avatar Feb 24 '24 03:02 ibarreto

@ibarreto I think that’s where the config used to be by default.

joeldrapper avatar Mar 17 '24 15:03 joeldrapper

The first part of this issue was fixed in #165. Open to pull requests adding the stylesheet link tag to ApplicationLayout.

joeldrapper avatar Mar 27 '24 21:03 joeldrapper

I run the initial phlex generator but I got this warning

CleanShot 2024-04-07 at 01 54 55@2x

so my tailwind config file was not updated.

CleanShot 2024-04-07 at 01 55 38@2x

Which are the routes that I need to manually add to the content array?

luiscobot avatar Apr 07 '24 06:04 luiscobot

@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?

trinitytakei avatar Aug 14 '24 12:08 trinitytakei