Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add rb files to the Tailwind content glob #564

Merged
merged 1 commit into from
May 26, 2022
Merged

feat: add rb files to the Tailwind content glob #564

merged 1 commit into from
May 26, 2022

Conversation

andrewmcodes
Copy link
Contributor

This is a 🙋 feature or enhancement.

Summary

This commit updates the Tailwind CSS content glob to also include ruby files when searching for classes in the src folder.

Context

Components, plugins, helpers, data files, etc. that are written in Ruby may contain Tailwind CSS classes that won't get generated by the JIT because they aren't in the content scope.

I have been using Tailwind for years but it took me close to 45 minutes before I realized the reason my classes were not generating the right CSS because they were in a Ruby component, not the accompanying erb file. Hopefully this will save people heartache and frustration if they run into the same issue and not make it be something you always need to add when generating a new site with Tailwind.

The one downside to this addition could be a performance hit. The larger the glob, the longer it takes Tailwind to scan for classes.

Here is why I think that is ok:

  • It is very easy to go in and scope down the glob if needed
  • You would need to have an enormous amount of files for it to start bringing down perf, plus most of them probably won't be pure Ruby making the hit minimal compared to markdown or ERB
  • The places you can write Ruby in your site is increasing, so people are bound to come across this and it can be very frustrating

A small change but hopefully it will at minimum save some frustration/time and prevent the need to Google to figure out what's happening.

Thanks for reading 😄

Components, plugins, helpers, data files, etc. that are written in Ruby may contain Tailwind CSS classes that won't get generated by the JIT because they aren't in the content scope. This commit updates the Tailwind content glob to also include ruby files when searching for classes in the src folder.
@jaredcwhite
Copy link
Member

Quite right! Seems like an oversight. LGTM

@jaredcwhite jaredcwhite merged commit dd11bce into bridgetownrb:main May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants