Skip to content

Fix/nested mixins reorder #1298

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

Merged
merged 7 commits into from
Feb 26, 2024

Conversation

pciarach
Copy link
Contributor

Fixes: #1297

This is an attempt to preserve the same order of style declarations in the case of nested mixins.

I think that the previous assumption that the mixin after rules or at-rules will resolve to more rules or at-rules is mostly valid because of the CSS nesting module draft (https://drafts.csswg.org/css-nesting/#mixing). However, this draft does not cover non-standard mixin rules and thus should be excluded from the grouping logic.

@romainmenke
Copy link
Member

@pciarach,
Thank you for this patch!

I've made a few edits because the original function was quite brittle.
It think my latest change is more in line with what I originally intended and I hope it also fixes all your issues.

I didn't see any new coverage from the mixin-nested-rules-after-media test, so I removed this. Please let me know if I overlooked something here.

@pciarach
Copy link
Contributor Author

Thank you @romainmenke

It looks really nice. I've also added a minor change to improve readability a bit.

When it comes to the additional test - you are right, the similar thing is covered by other mixin tests.

@romainmenke
Copy link
Member

Thank you for checking this @pciarach,

As a general note, it is best to not nit changes in someone else's project for readability because readability is highly subjective. The code I wrote was in the most readable form for me and since I be maintaining it that is more important.

I do appreciate the intention behind the changes 🙇

Do you mind changing it back?

@pciarach
Copy link
Contributor Author

Sure, as you said you will be maintaining it so you have the last word 😉

Copy link
Member

@romainmenke romainmenke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this @pciarach,
This is a complex feature and the test cases and pull request really helped to make it better 🎉

@romainmenke romainmenke merged commit 288b792 into csstools:main Feb 26, 2024
@pciarach
Copy link
Contributor Author

@romainmenke Thanks for the help and such a quick responses!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[postcss-nesting] Nested mixins declaration order
2 participants