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

[v4] Source glob pattern ./**/*.{js,ts,jsx,tsx,mdx} does not match Next.js-style catchall route segments like [...slug]. #16287

Open
nicksergeant opened this issue Feb 5, 2025 · 3 comments

Comments

@nicksergeant
Copy link

What version of Tailwind CSS are you using?

v4.0.3

What build tool (or framework if it abstracts the build tool) are you using?

  • Next.js 15.1.6
  • PostCSS 8

What version of Node.js are you using?

23.5.0

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction URL

https://github.com/nicksergeant/tailwind-v4-dynamic-params/

Describe your issue

If you are disabling automatic detection with:

@import 'tailwindcss' source(none);

and then configuring a glob pattern like this:

@source './**/*.{js,ts,jsx,tsx,mdx}';

Source files in directories such as [...slug] will not be picked up: https://github.com/nicksergeant/tailwind-v4-dynamic-params/blob/main/app/%5B...slug%5D/page.tsx

I'm not sure if this is a bug per se, and I have found this workaround:

@source './**/*.{js,ts,jsx,tsx,mdx}';
@source './[[]**[]]/*.{js,ts,jsx,tsx,mdx}';

Example page showing missing style: https://github.com/nicksergeant/tailwind-v4-dynamic-params/blob/main/app/%5B...slug%5D/page.tsx#L4

But I was surprised that ./**/* was not working to pick those up.

@neoplastic
Copy link

Wow. That's the problem I was having, I was wondering why some of the custom classes weren't working in my code.

@nicksergeant
Copy link
Author

I'm also not sure if my posted workaround above is actually sufficient. For some reason it seems to be working in my isolated test case above, but not in our larger repo using the same versions.

@neoplastic
Copy link

I have a relatively large repo which I upgraded from 3 -> 4 beta -> 4.

Mine's actually happening on a regular routed segments (/my/route/), its probably happening on leaf segments too (/my/route/[id])

I could use some of the old tailwind sizes like h-96 but anything new or calculated wasn't working. Was racking my head around it with some new components over the past couple days.

I had the feeling that it was some of the files weren't being scanned over by tailwind to generate the CSS for it.

If its not working in your larger repo is there some complexity in the path names to your js/ts/etc files?

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

2 participants