Skip to content

docs: Add link to Safelisting specific utilities from upgrade guide #2266

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

Merged
merged 3 commits into from
Jun 13, 2025

Conversation

CanRau
Copy link
Contributor

@CanRau CanRau commented May 30, 2025

Think it'd be helpful to have the @source inline feature mentioned in upgrade guide instead of it just saying safelist doesn't exist anymore (this might be a newer feature than when the docs were written).

Maybe could've been a little section or something, but wasn't sure how to do it best, and I think like this is better than not at all 🤓

Add link to `Safelisting specific utilities` from upgrade guide
Copy link

vercel bot commented May 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tailwindcss-com ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2025 5:10pm

@rozsazoltan
Copy link
Contributor

rozsazoltan commented Jun 9, 2025

I believe people mostly use this feature in harmful ways, so I was glad it wasn't included in v4. That said, its not a bad thing that the option is available again from v4.1 - though it will likely lead to many projects where an unnecessary number of classes end up in the compiled CSS, instead of writing more dynamic classes tailored to their needs.

e.g.: tailwindlabs/tailwindcss#15291 (comment)

By the way, it's easy to find.

image

The `safelist` config option still isn’t supported so it should stay in the list. But calling out how you can safelist utilities now is still a good idea.
@thecrypticace
Copy link
Contributor

I believe people mostly use this feature in harmful ways, …

With the regex version of safelist it was very easy to cause problems. You can definitely still generate way too much CSS than you need with the brace expansion syntax but it's a lot more "visible" than it was previously. IntelliSense will even tell you how many classes you're generating above each use of @source inline(…) and give a very rough estimate the amount of generated CSS if we think it'll get large enough:

Screenshot 2025-06-13 at 13 02 46 Screenshot 2025-06-13 at 13 02 53

I do think it's reasonable to link to the @source inline(…) docs from there though for the people who need it.

@thecrypticace thecrypticace merged commit 726683e into tailwindlabs:main Jun 13, 2025
2 checks passed
@thecrypticace
Copy link
Contributor

I tweaked the wording a bit and removed the change that removed safelist from the list of unsupported config options. The safelist config option still isn't technically supported because the mechanism we use in v4 through @source inline(…) is different.

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

Successfully merging this pull request may close these issues.

3 participants