rails / tailwindcss-rails

MIT License
1.42k stars 174 forks source link

missing Tailwind CSS in production #9

Closed freesteph closed 3 years ago

freesteph commented 3 years ago

Hey, thanks for the gem which was a breeze to use in development:

image

However in production the Tailwind CSS appears to be missing:

image

If I manually edit the production HTML and add a CDN-version of Tailwind, it looks fine. Am I missing a step to have production correctly pick up the assets?

From the README I thought it would be taken care of:

In development mode, the full 3mb+ Tailwind stylsheet is loaded, but in production, only the css classes used by files in app/views and app/helpers are included.

freesteph commented 3 years ago

I've pried into the gem and I strongly suspect the issue is my templates being written in HAML rather than ERB. Would that be it?

freesteph commented 3 years ago

That is it. Going to attempt a HAML purger and will report back if anything succeeds.

freesteph commented 3 years ago

I did manage to write some code around HAML files; it's far from perfect but it does the job for my application. I don't know if it's something worth considering for merge, but the changes are here:

https://github.com/rails/tailwindcss-rails/compare/main...freesteph:haml