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

Update Marpit PostCSS root increasing specificity plugin to change selector #302

Merged
merged 4 commits into from
Jul 8, 2021

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented May 25, 2021

For compatibllity with some CSS parsers, used :not(a) pseudo-class selector instead of :not(\9).

:root {
  color: red;
}

section {
  color: blue;
}

will transform into:

section:not(a) { /* section is always not `a` */
  color: red; /* CSS specificity -> 0-0-2 [win] */
}

section {
  color: blue; /* CSS specificity -> 0-0-1 [lose] */
}

:marpit-root is always added to section selector so :not(a) must always match.

This change will slightly reduce converted CSS size.

@yhatt yhatt merged commit 0f6c5b8 into main Jul 8, 2021
@yhatt yhatt deleted the update-how-to-increate-specificity branch July 8, 2021 16:44
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 this pull request may close these issues.

1 participant