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

Safelist option doesn't work ? #312

Closed
joffreyBerrier opened this issue Mar 19, 2021 · 9 comments
Closed

Safelist option doesn't work ? #312

joffreyBerrier opened this issue Mar 19, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@joffreyBerrier
Copy link

joffreyBerrier commented Mar 19, 2021

Version

@nuxtjs/tailwindcss: ^4.0.1
nuxt: 2.15.3

Reproduction Link

https://codesandbox.io/s/elegant-tu-xipm4

Steps to reproduce

  • Add classes on purge: { options: { safelist: [] } } doesn't work

What is Expected?

  • I would like to force tailwind to keep safelist classes

What is actually happening?

  • Safelist doesn't worked
@joffreyBerrier joffreyBerrier added the bug Something isn't working label Mar 19, 2021
Copy link
Collaborator

Atinux commented Mar 19, 2021

Could you provide a reproduction please?

@joffreyBerrier
Copy link
Author

@Atinux you didn't have access to the codesandbox reproduction link ?
=> https://codesandbox.io/s/elegant-tu-xipm4

@ghost
Copy link

ghost commented Mar 19, 2021

You're using JIT which doesn't support it yet
https://github.com/tailwindlabs/tailwindcss-jit#known-limitations

@joffreyBerrier
Copy link
Author

Thx @web2033 but purge: { content: [] } it works?

@ghost
Copy link

ghost commented Mar 19, 2021

I think with JIT it works in reverse. It's not purging now but creating classes on the fly.

@joffreyBerrier
Copy link
Author

Ok, to solved the problem I have created a fake component with all the classes I want to safe which I called on the content array and its worked but it's not pretty

@joffreyBerrier
Copy link
Author

@web2033 "Advanced PurgeCSS options like safelist aren't supported yet since we aren't actually using PurgeCSS. We'll add a way to safelist classes for sure though. For now, a safelist.txt file somewhere in your project with all the classes you want to safelist will work fine."

it works?

@joffreyBerrier
Copy link
Author

Create a safelist.txt which contains all your classes you want to safe:

// Safelist.txt
md:w-1/2
md:w-6/12
...

Call the file on the content section of the purge

purge: {
    content: [
      './safelist.txt',
    ],
  },

@alfredomtzrmz
Copy link

is there another way to add safelist without add some fake file like safelist.txt ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants