-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add postcss-sorting integration #161
Add postcss-sorting integration #161
Conversation
@nkt Thank you for you PR! Good stuff :) But, I have a question. Are you taking into account using with There is a possibility to change source code destructive by sorting declarations. Please see also #3 (comment) . Thanks. |
|
||
function formatOrder(root, params) { | ||
var sortOrder = params.stylelint['declaration-block-properties-order']; | ||
if (!Array.isArray(sortOrder)) { |
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.
@morishitter maybe I should add check for sass right here?
if (params.isSass || !Array.isArray(sortOrder)) {
return;
}
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'd like to consider with at-rules e.g. @apply
, @include
of SCSS and @mixin
of postcs-mixins. I think, at-rules in declaration nodes of PostCSS should be on the top of its declaration.
.selector {
font-size: 12px;
max-width: 280px;
@include truncate();
}
The above code will be formatted to the following code.
.selector {
@include truncate();
max-width: 280px;
font-size: 12px;
}
What do you think?
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.
This is already supported by postcss-sorting. I've updated tests.
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.
Here is docs: https://github.com/hudochenkov/postcss-sorting#at-rules
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.
postcss-sorting also supports grouping, but this feature not supported by stylelint 😞
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.
Wow, nice! I wish stylelint will support it.
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.
FYI, stylelint does support property groups.
fe27387
to
d9c2100
Compare
@nkt Thank you so much ;) |
This is fantastic! Great job :) You might be interested in keeping an eye on this proposal for a companion plugin to |
Thanks @nkt! |
No description provided.