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

@source directive does not glob across symlink directories #16765

Open
borama opened this issue Feb 24, 2025 · 0 comments
Open

@source directive does not glob across symlink directories #16765

borama opened this issue Feb 24, 2025 · 0 comments

Comments

@borama
Copy link

borama commented Feb 24, 2025

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:

  1. benchmark test - globbing a real directory name (works OK)
$ cat input.css
@import "tailwindcss" source(none);
@source "ab*/*.html";

$ tree
.
├── abcd
│   └── xyz.html
└── input.css

$ cat abcd/xyz.html
<div class="bg-red-100">Hi</div>

$ tailwindcss -i input.css | grep bg-red-100
≈ tailwindcss v4.0.7

Done in 19ms
  .bg-red-100 {
# the class has been added
  1. trying to glob a symlink name (does NOT work)
$ ln -s abcd efgh

$ tree
.
├── abcd
│   └── xyz.html
├── efgh -> abcd
└── input.css

# amend input.css to glob the symlink instead
$ cat input.css
@import "tailwindcss" source(none);
@source "ef*/*.html";

$ tailwindcss -i input.css | grep bg-red-100
≈ tailwindcss v4.0.7

Done in 19ms
# the class has not been added

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 (think efgh-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.

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

No branches or pull requests

1 participant