Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Conversation

@barnabasmolnar
Copy link
Contributor

Fixes #42.

As far as I understood the code, it was checking for the first character to be a - to treat it as a negative class. However, it's not guaranteed that - will always be the first character as the user can freely set a prefix in their config file.

It follows, then, that a class will be negative if the first character after the prefix is -.

What we want to do here is

  1. let tailwind know that it needs to generate a negative class by setting the negative flag to true
  2. retain the user defined prefix in candidatePrefix so that given a tw--ml-4 class tw-ml-4 can be passed to the generator

From that point on the logic stays exactly the same, that is, when the negative flag is set, the modifier from the candidate will be prefixed with a -.

I've added a few test cases which seem to have run fine.

Let me know what you guys think.

@adamwathan
Copy link
Member

My man 👊 Great PR, thank you!

@adamwathan adamwathan merged commit 6a076ea into tailwindlabs:main Mar 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doesn't generate negated classes with prefix configured

2 participants