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

@apply prose is failing the first- and last-child selectors #351

Closed
mario-neuhold opened this issue Apr 23, 2024 · 1 comment
Closed

@apply prose is failing the first- and last-child selectors #351

mario-neuhold opened this issue Apr 23, 2024 · 1 comment

Comments

@mario-neuhold
Copy link

What version of @tailwindcss/typography are you using?

0.5.12

What version of Node.js are you using?

20

What browser are you using?

Chrome and Edge

What operating system are you using?

Win11

Reproduction repository

https://play.tailwindcss.com/WJj0WzrLV6

Describe your issue

When using @apply prose on a class e.g. .is-style-prose the generated css for removing the top margin of its first child looks like this:

.is-style-prose
  :where(
    /* this should be .is-style-prose instead of .prose */
    .prose > :first-child 
  ):not(
    :where(
      [class~="not-prose"],[class~="not-prose"] *
    )
  ) {
    margin-top: 0;
  }

So the wrong class name in the :where() clause causes the top margin from h2, h3, .. to not being removed. Same goes for the bottom margins of the last-child of the prose class.
See https://play.tailwindcss.com/WJj0WzrLV6

@mario-neuhold
Copy link
Author

Thanks for taking your time to tackle and discuss this in #352!
Since it's unlikely to be possible in v3, I will fall back to changing the prose classname to is-style-prose as mentioned in the readme: https://github.com/tailwindlabs/tailwindcss-typography?tab=readme-ov-file#changing-the-default-class-name. This way I don't have to use @apply prose.

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

Successfully merging a pull request may close this issue.

1 participant