No option to not sort certain properties and leave them alone?
See original GitHub issueThere doesn’t appear to be an option to disable the sorting of rules (not properties)? I don’t want csscomb to put my includes/breakpoints above normal rules as this would obviously break things.
My csscomb in Atom is pretty much useless.
Edit: This appears to only happen when nested inside another element
Example:
body.form-pages {
.some-selement {
display: none;
}
@include bp(min-width, $bp-small+1) {
.some-element {
display: inline;
}
}
@include bp(min-width, $bp-medium+1) {
.some-element {
display: block;
}
}
}
running csscomb turns my file into…
body.form-pages {
@include bp(min-width, $bp-small+1) {
.some-element {
display: inline;
}
}
@include bp(min-width, $bp-medium+1) {
.some-element {
display: block;
}
}
.some-selement {
display: none;
}
}
Which obviously is very bad, since now the properties that apply would be very different from what I intended. Is there some way to tell CSSComb to ignore @include and other properties and leave them be? I saw theres a rule for leftovers… but I don’t want the leftovers moved at all, can the leftovers be set to ignore?
I’m thinking we need a way specify that we want to sort “around” a property… not sure how impossible that would be. I’m dying to use CSSComb but it doesn’t seem to agree with sass if you’re using @includes to do things like breakpoints and things.
In Magento and some other platforms a lot of the sass is modularized by nesting it all underneath one tag that the body has. So any @include or @extends inside of the nest get moved around, breaking everything.
<bountysource-plugin> --- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/35923294-no-option-to-not-sort-certain-properties-and-leave-them-alone?utm_campaign=plugin&utm_content=tracker%2F214563&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F214563&utm_medium=issues&utm_source=github). </bountysource-plugin>Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
Top GitHub Comments
There is a way to combat this:
This allows all non-specified includes to be at the top, where they really belong, followed by all specified rules, followed by specified includes, such as breakpoints, which belong at the end of the declaration.
Hope this helps. We’ve been using it successfully for some time now.
I realise that it doesn’t tackle the “ignore” nature of this question, but it does go some way towards helping solve the issue.
It seems that the main issue here is that it’s usually preferably to have
@include
s first within a selector.What’s happening here, and what I’ve found on my build, is that it would be useful to be able to exclude or reorder certain things that are being included, like breakpoint mixins, as they’re likely to want to come last.
The only way I can think of to tackle this would be to allow a more specific selector in the
sort-order
that allows expansion of"$include"
to include the mixin name. No idea how to though, sorry.