Skip to content

feat: add space / divide exceptions #1598

Closed
@lihbr

Description

@lihbr

Hi hi, quite hyped about the latest release though I feel the need to discuss about the following, whether it's to rework my mind or perhaps to find a solution about this.

What problem does this feature solve?

As stated in #1584 current implementation doesn't allow exceptions like that:

<ul class="space-y-4">
  <li>One</li>
  <li class="mt-0">Two</li>
  <li>Three</li>
</ul>

And I don't know why (perhaps I'm thinking about stacks wrong) but I almost always have one exception in my stacks that would require the above, which is currently not possible, and preventing me from using this new feature.

What does the proposed changes look like?

What I'm suggesting is to add an exception class on children that require an exception like space-y-exception or space-y-ignore to tell the parent to not apply margins / borders on them, so the implementation can be modified to something like this probably:

.space-y-4 > :not(template):not(.space-y-exception) ~ :not(template):not(.space-y-exception) {
  margin-top: 1rem
}

The downside of this is that specificity increase even more (from 0 1 2 to 0 3 2), though given that current specificity doesn't allow this anyway I don't see it as a problem.

Any thoughts? Perhaps I'm missing some other edge cases, don't know~
Anyway, thanks for any feedback!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions