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
Media query option to preserver order #92
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment regarding expected behaviour and making the rules preserve order by default. Happy to approve the changes as the fix works as expected.
shouldPreserve = shouldPreserve || false; | ||
preserveAtRulesOrder = preserveAtRulesOrder || false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the expected behaviour would be to maintain the CSS rule order. Therefore, would this make more sense defaulting to true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@awilson82-vp I am in favor of making the default be in order as expected. We can make a major release to play nice for people who have already worked around it.
Even removing the option completely seems reasonable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MadLittleMods Could we release this new option as-is now (minor release), and then change default to true
in the next major release? That would allow us to start using it immediately.
Happy to help out if anything else needs to be done before this can be released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dampkwab We can do a major release now (no need to wait for anything else). We just need to update the default in this PR.
A minor release is just extra work for no reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MadLittleMods I've updated the default now - hope that helps :)
#100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#100 (comment) is now abandoned
I created #101 which removes the playground/
changes so we can build fresh from master
. It seems like we should have some more tests though. So someone will need to pick that up
If we updated this merge request default to true
, all of the current tests would need to be updated which would give us nice coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MadLittleMods
Uff, I really need this fix ASAP =D
What about sticking with harmless preserveAtRulesOrder=false as default until you finish your wished result ^^)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dinodujmovic Sure 🤷♀ , now published: #92 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot !
@erikthalen Sorry for not reviewing this sooner ❤️. Thanks for the fix! @awilson82-vp Thanks for taking a look 💯 |
First of all, thanks for your work. |
@Ciul I've moved to using postcss-preset-env instead - it only supports variable declarations on |
Closing as we haven't got a response from @erikthalen #101 holds the latest of this if someone wants to pick it up again |
This was merged via #101 and is now published in Thanks @erikthalen for the contribution ❤️ |
Glad I could help! |
Wanted to extend a big and sincere thank you for this, @erikthalen (and @MadLittleMods)! Made our workflow a lot smoother. |
As in #30, our media queries got re-ordered when running this plugin.
I've added an option to preserve at-rule-order, which makes it all good again. In the current project I'm on we're developing mobile first and it's crucial that the smaller @media-rule doesn't overwrite the bigger one (which should come after the first one).
When the new option is true:
all the at-rules will be inserted in the CSS after the previously computed one. Instead of being inserted right after the parent selector. The new option should be used when using min-widths, and should be set to false when using max-widths.
The new option defaults to false, meaning no change from how the plugin behaved before.