Skip to content

Ignore Rails runtime dirs in Tailwind source scanning#609

Open
nehanakrani wants to merge 1 commit intorails:mainfrom
nehanakrani:codex/ignore-runtime-tailwind-sources
Open

Ignore Rails runtime dirs in Tailwind source scanning#609
nehanakrani wants to merge 1 commit intorails:mainfrom
nehanakrani:codex/ignore-runtime-tailwind-sources

Conversation

@nehanakrani
Copy link
Copy Markdown

This excludes Rails runtime directories from the default Tailwind source scan.

Tailwind watches generated files under directories like log, tmp, and storage by default, which can trigger unnecessary rebuilds in development. The default generated application.css now opts those directories out with @source not.

Fixes #491.

Tests:

  • bundle exec bin/test

@flavorjones
Copy link
Copy Markdown
Member

@nehanakrani Thanks for opening this pull request.

There's a bit of history here, and I'm not sure that this pull request addresses the issue.

The original bug report on this project is #491 as you noted in the description. That issue references an upstream issue tailwindlabs/tailwindcss#15684 which as far as I know is still unresolved.

I attempted to test the approach in this PR by:

  • creating a new rails app rails new test-tailwind-source --css=tailwind
  • in that project dir, rails generate scaffold post title:string body:text published:boolean
  • bin/setup
  • edit app/assets/tailwind/application.css with @source note (see below for details)
  • bin/rails server in terminal 1
  • bin/rails tailwindcss:watch in terminal 2

The contents of app/assets/tailwind/application.css are:

@import "tailwindcss";
@source not "../../../log";
@source not "../../../tmp";
@source not "../../../storage";

And the original problem still manifests: when I make a request to the development server, and the log is appended-to, then I see tailwind kick off a scan:

bin/rails tailwindcss:watch
≈ tailwindcss v4.2.4

Done in 65ms
Done in 2ms
Done in 2ms
Done in 1ms
Done in 1ms
Done in 2ms
Done in 1ms

Can you help me understand:

  1. whether I have correctly understood the problem you're trying to solve
  2. if you see this issue fixed on your system if you follow the above steps

Thank you!

@flavorjones flavorjones added the needs-more-info Further information is needed to unblock label May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-more-info Further information is needed to unblock

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default config should not watch log directory (and probably others)

2 participants