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

How to safelist tailwindcss classes in nuxt 3 #3795

Closed
schillerenrico opened this issue Apr 4, 2025 · 2 comments
Closed

How to safelist tailwindcss classes in nuxt 3 #3795

schillerenrico opened this issue Apr 4, 2025 · 2 comments
Labels
question Further information is requested v3 #1289

Comments

@schillerenrico
Copy link

Description

Hi, I was wondering how to safelist dynamic generated tailwind classes.

Currently I hardcode an element with theses classes to generate them but I would rather prefer a safelist option somewhere. Is something like this possible?

Classes that need to be compiled:
w-[100px] w-[140px] w-[180px] w-[220px] w-[260px] w-[300px]

Current solution with a hidden element:
<span class="hidden w-[100px] w-[140px] w-[180px] w-[220px] w-[260px] w-[300px]"></span>

@schillerenrico schillerenrico added question Further information is requested v3 #1289 labels Apr 4, 2025
Copy link
Member

benjamincanac commented Apr 4, 2025

You're lucky this just dropped in Tailwind CSS v4.1: https://tailwindcss.com/blog/tailwindcss-v4-1#safelist-specific-utilities-with-source-inline

You can either refresh your lock to have the latest tailwindcss version or install it yourself.

@schillerenrico
Copy link
Author

Just awesome :) Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested v3 #1289
Projects
None yet
Development

No branches or pull requests

2 participants