-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat: add space / divide exceptions #1598
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
Comments
Can you share a real-world example in case there's a better solution? |
@adamwathan Sure! I've made a small example here about using/migrating to Current design without <div class="p-4 bg-gray-200">
<div>History - 21/04/2020</div>
<h2 class="mt-4 text-xl font-bold">
How Max Bill created a design for Junghans
</h2>
<p class="mt-4">
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vitae alias
illo reprehenderit, incidunt quia ab aliquam eum voluptatibus repellat
tenetur recusandae totam quibusdam. Ducimus perspiciatis labore sint,
harum cupiditate tenetur?
</p>
<a class="mt-12 block underline" href="#">Read more</a>
</div> Migration to <div class="space-y-4 p-4 bg-gray-200">
<div>History - 21/04/2020</div>
<h2 class="text-xl font-bold">
How Max Bill created a design for Junghans
</h2>
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vitae
alias illo reprehenderit, incidunt quia ab aliquam eum voluptatibus
repellat tenetur recusandae totam quibusdam. Ducimus perspiciatis
labore sint, harum cupiditate tenetur?
</p>
<a class="space-y-exception mt-12 block underline" href="#">Read more</a>
</div> |
Great thanks for that! In this case I would recommend structuring the markup like this: <div class="space-y-12 p-4 bg-gray-200">
<div class="space-y-4">
<div>History - 21/04/2020</div>
<h2 class="text-xl font-bold">
How Max Bill created a design for Junghans
</h2>
<p>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vitae alias illo reprehenderit,
incidunt quia ab aliquam eum voluptatibus repellat tenetur recusandae totam quibusdam. Ducimus
perspiciatis labore sint, harum cupiditate tenetur?
</p>
</div>
<a class="block underline" href="#">Read more</a>
</div> It's one extra I did a really great interview with @markdalgleish a couple of months ago where we talked about this idea of using nested |
Thanks for having a look at my case, makes sense regarding that! I'm somewhat convinced but I'll give a shot for sure at the interview in order to make up my mind about all of this. Also I think I'll roll a simple plugin that add similar utilities anyway as I need to support IE correctly, that's the power of Tailwind after all~ |
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:
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
orspace-y-ignore
to tell the parent to not apply margins / borders on them, so the implementation can be modified to something like this probably:The downside of this is that specificity increase even more (from
0 1 2
to0 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!
The text was updated successfully, but these errors were encountered: