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

media-query duplicates its generated styles #14222

Open
Tobitubbie opened this issue Aug 20, 2024 · 1 comment
Open

media-query duplicates its generated styles #14222

Tobitubbie opened this issue Aug 20, 2024 · 1 comment

Comments

@Tobitubbie
Copy link

Tobitubbie commented Aug 20, 2024

What version of Tailwind CSS are you using?
v3.4.10
(tested in v3.4.4, too)

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

What version of Node.js are you using?
v18.20.1

What browser are you using?
Chrome

What operating system are you using?
Windows

Reproduction URL
https://play.tailwindcss.com/4aiEEar1oo?file=config

Describe your issue

The 3 preconditions for the error to occur are:

  • important is true or set to a string
  • some safelist-pattern is configured and matches
  • styles are inside a media-query

Every style (key of the object) defined for the media-query is repeated x times in the final generated css!


2 times on sibling css:

'@media (...)': { 
  '.a': {...}, 
  '.b': {...} 
}

=> results in:

@media (...): { 
  '.a':  {...}, 
  '.b':  {...}, 

  '.a':  {...}, 
  '.b':  {...} 
}

3 times on nested css:

'@media (...)': { 
  '.a': { '.b': {...} } 
}

=> results in:

'@media': { 
  '.a .b':  {...}, 

  '.a .b':  {...}, 

  '.a .b':  {...}
}

5 nested properties ( a { b { c { d { e } } } } ) lead to 15 duplications

This is increasing our final stylesheet quite a bit 🥲

Is this intended behaviour or am I doing something wrong?

@monixca345
Copy link

monixca345 commented Sep 30, 2024

Thanks for the step by step tutorial. Works like a charm! The solution worked for me thanks to the community and the members for the solution. aa jetnet

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

2 participants