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

Compatibility with purge #5

Open
thec0keman opened this issue Jun 4, 2021 · 2 comments
Open

Compatibility with purge #5

thec0keman opened this issue Jun 4, 2021 · 2 comments

Comments

@thec0keman
Copy link

When setting up tailwind'd purge feature, our named groups appear to be purged. Is it possible to configure named groups in the safelist?

@m-rgba
Copy link

m-rgba commented Feb 18, 2022

As of Tailwind 3.0 I was having some problems with JIT purging classes inconsistently for the named groups (especially when having nested groups - usually would take the parent and purge the child).

I used the following in my config:

const config = {
...
  safelist: [{
    pattern: /.*/,
    variants: [
      "group-hover",
      "group-focus"
    ]
  }],
...
};

Note - this is working because it's safelisting all group tags of hover and focus across all the variants (so it may not be the smallest bundle you can get to -- you may want to narrow down the pattern a bit), but it works for my use-case.

@armorasha
Copy link

armorasha commented Mar 23, 2022

Extending on the above answer, my working code for tailwind 3.x in tailwind.config.js is:

...
module.exports = {
  content: [
    ...
  ],
  // safelisting so that namedGroups can work in tailwind 3.x
  safelist: [{
    pattern: /.*/,
    variants: [
      "group-hover",
      "group-focus"
    ]
  }],
...

Thanks @m-rgba

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

3 participants