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

Utility Classes Not Generated When Number is Followed by an Underscore in v4.0.10 #16978

Closed
woohm402 opened this issue Mar 6, 2025 · 2 comments · Fixed by #16980
Closed

Utility Classes Not Generated When Number is Followed by an Underscore in v4.0.10 #16978

woohm402 opened this issue Mar 6, 2025 · 2 comments · Fixed by #16980

Comments

@woohm402
Copy link
Contributor

woohm402 commented Mar 6, 2025

What version of Tailwind CSS are you using?

v4.0.10

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

Vite 6.2.0

What version of Node.js are you using?

v20.18.1

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction URL

https://github.com/woohm402/tailwindcss-4.0.10-bug-reproduction-1

npm run dev and then visit http://localhost:5173 will work

Describe your issue

Using the legacy JavaScript config in v4.0.10, the theme font configuration with the name Title1_Strong does not generate a utility class, whereas Title_Strong does. In v4.0.9 and earlier versions, both utility classes were generated properly. The text-Title_Strong utility class is created, but text-Title1_Strong is not.

It appears that any font names following the \d_ pattern do not generate utility classes. However, other patterns such as Title1Strong and Title__Strong work properly.

tailwind config created css
Image Image
@woohm402
Copy link
Contributor Author

woohm402 commented Mar 6, 2025

Also class text-Title1-Strong (dash instead of underscore) has the same issue

@woohm402
Copy link
Contributor Author

woohm402 commented Mar 6, 2025

I’ve submitted #16980 to address this issue. If there are any concerns or if this isn’t the right approach, please feel free to close it. Thank you for your time and consideration :)

RobinMalfait pushed a commit that referenced this issue Mar 6, 2025
…xtracted correctly (#16980)

Fixes #16978, and also added support for dash.
Classes like `text-theme1-primary` or `text-theme1_primary` should be
treated as valid.

If this approach is not aligned with the project’s direction or there
are any concerns, please feel free to close or edit this PR 😃

<br/>

### As is

Classes conatining number followed by dash or underscore (e.g.
`bg-theme1-primary`, `text-title1_strong`) are ignored, and utility
classes are not generated.

### To be

Classes conatining number followed by dash or underscore (e.g.
`bg-theme1-primary`, `text-title1_strong`) are treated as valid
tailwindcss classes

---------

Co-authored-by: Philipp Spiess <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant