Skip to content

"@apply prose" breaks all further instances of @apply #219

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

Closed
Joobs opened this issue Nov 29, 2021 · 2 comments
Closed

"@apply prose" breaks all further instances of @apply #219

Joobs opened this issue Nov 29, 2021 · 2 comments
Assignees

Comments

@Joobs
Copy link

Joobs commented Nov 29, 2021

What version of @tailwindcss/typography are you using?

3.0.0-alpha.2

What version of Node.js are you using?

v14

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction repository

https://play.tailwindcss.com/cM8QtjobVQ

Describe your issue

I was experimenting with the new Tailwind JIT CDN and I noticed an issue with the Typography plugin. I've not tried it on a production setup.

If i use @apply prose the compiler seems to ignore any future @apply rules (either on the same line, or further down the CSS).
The bug is present in Tailwind V3 Alpha2, but compiles as expected if i switch to V2.2.19. Switch between the two versions to see the differences. In my example it ignores the prose-2xl and @apply text-red-500 rules after prose is applied.

Example: (switch between Tailwind versions)
https://play.tailwindcss.com/ogV2iFjxm3

Tailwind 3 Alpha:
Screenshot 2021-11-29 at 06 12 45

Tailwind 2:
Screenshot 2021-11-29 at 06 13 09

@LiamThursfield
Copy link

LiamThursfield commented Dec 10, 2021

Unsure if this is related but I have this:

.mce-content-body {
    @apply prose;
}

Looking through the generated CSS I have found the broken bit off CSS is:

.mce-content-body :where(ul ul{
    margin-top: 0.75em;
    margin-bottom: 0.75em;

}

So any CSS generated after this doesn't work/is ignored.

I assume this should be:

.mce-content-body :where(ul ul){
    margin-top: 0.75em;
    margin-bottom: 0.75em;
}

Update:

The code is above my head but it looks to be the fact that in styles.js the selector contains commas i.e.

'ul ul, ul ol, ol ul, ol ol': {
  marginTop: em(12, 16),
  marginBottom: em(12, 16),
},

Changing to this fixes the issue:

'ul ul': {
    marginTop: em(12, 16),
    marginBottom: em(12, 16),
},
'ul ol': {
    marginTop: em(12, 16),
    marginBottom: em(12, 16),
},
'ol ul': {
    marginTop: em(12, 16),
    marginBottom: em(12, 16),
},
'ol ol': {
    marginTop: em(12, 16),
    marginBottom: em(12, 16),
},

So I imagine the issue is upstream somewhere when processing selectors with commas.

Hope this helps someone with a better understanding of how it all works!

@thecrypticace thecrypticace self-assigned this Mar 1, 2022
@thecrypticace
Copy link
Contributor

Thanks for the report. I just checked and this appears to work fine in the latest version of Tailwind CSS v3!

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