-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
@source directive does not glob across symlink directories #16765
Comments
I have the same issue. I had to specify the exact path to the link in order to get Tailwind to pick up classes in the linked folder. The symlink is inside my current working directory, so I was expecting Tailwind to automatically pick up those files as per the documentation here: https://tailwindcss.com/docs/detecting-classes-in-source-files After an hour or so of trying to find the solution with Google searches and discussions with LLM's, I decided to log an issue, but luckily I found this issue when I tried to make sure my issue hasn't been logged already. So I got a solution to my problem. My setup is like this:
And in @import "tailwindcss";
@source "./components/common/*.tsx"; And I can find the classes in my symlinked directory:
Keep in mind that my linked folder is flat. I am not sure whether it will work for sub-folders in the linked folder. However, if I leave out the @source directive: @import "tailwindcss";
/* @source "./components/common/*.tsx"; */ I can't find the classes anymore:
I think this problem might be related to the one @borama experienced. Also, to confirm the issue @borama logged. If I have this in @import "tailwindcss";
@source "./components/com*/*.tsx"; I also can't find the classes in the linked directory:
|
I got subfolders inside the linked directory to work like this: @import "tailwindcss";
@source "./components/common"; |
The
@source
directive does not work when it contains a glob matching a symlink. It is a problem when we need to source a symlink directory that is versioned.What version of Tailwind CSS are you using?
4.0.7
What build tool (or framework if it abstracts the build tool) are you using?
none
What version of Node.js are you using?
23.8
What browser are you using?
n/a
What operating system are you using?
Linux
Reproduction URL
https://github.com/borama/tw4-symlink-glob
Reproduction steps:
Describe your issue
When the glob pattern in the
@source
directive matches a directory name that is a symlink, Tailwind does not recognize it as a match and does not source the files inside it. This is a problem when a dependency that we want to source is versioned and symlinked (thinkefgh-3.4.123
in the test above) and we don't want to update the source whenever we upgrade the dependency.Might be related to #16038 but I came across it in the context of ruby gems and this might be rather about the suffix
*
matching than symlinked directory traversal.The text was updated successfully, but these errors were encountered: