Skip to content
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

Option Request: space-between-nested-blocks #317

Closed
PD-WebTools opened this issue Sep 23, 2014 · 13 comments
Closed

Option Request: space-between-nested-blocks #317

PD-WebTools opened this issue Sep 23, 2014 · 13 comments

Comments

@PD-WebTools
Copy link

I would like to suggest an option, space-between-nested-blocks. For my needs, I'd just like to make sure there is a line between my current rules and a nested selector. Example:

Example Source

.foo {
  color: black;
  .bar {
    color: gray;
  }
}

space-between-nested-blocks = true

.foo {
  color: black;

  .bar {
    color: gray;
  }
}
@ixax
Copy link

ixax commented Sep 29, 2014

👍

@tonyganch
Copy link
Member

sort-order option adds a line between sorted declarations and everything else.
If you don't want to set a specific order for properties, you can always set "sort-order": ["..."] in your config.

@ixax
Copy link

ixax commented Sep 29, 2014

@tonyganch, this doesn't work for me :( http://pastebin.ru/mEq1TGhV

@1999
Copy link

1999 commented Sep 29, 2014

@tonyganch double-checked it, "sort-order": ["..."] removes empty lines.

@tonyganch tonyganch reopened this Sep 29, 2014
@tonyganch
Copy link
Member

Should be fixed in 3.0.3.

@1999
Copy link

1999 commented Sep 29, 2014

Thank you!

@tonyganch tonyganch reopened this Sep 29, 2014
@tonyganch
Copy link
Member

I'm sorry for closing the issue. I've misread description, it's not fixed really.

@PD-WebTools, is this issue somehow related to #210?

@hudochenkov
Copy link
Contributor

@tonyganch, what are you think about this commit? It looks like solution for this. This issue not exactly related to rule-delimeter and you pointed on this in comment.

I've also need this feature and want to try make PR.

@tonyganch
Copy link
Member

@hudochenkov, can you show a few examples (before and after) to illustrate what you want to achieve?

@tonyganch
Copy link
Member

@hudochenkov, you want to sort rulesets too? Based on selectors?

@hudochenkov
Copy link
Contributor

I want to visual separate block's properties, includes, extends and it's children. As I understand, now block's children not participating in sort-order. So it glued with no empty lines with all sort-order effected nodes. If we can identify all block's children as one entity, we can put them in sort-order. Previous implementation of $include works similar way: it gather all @include and @​extend in order presented in source file.

Example config:

{ "sort-order": [

["position", "top", "left", "margin", "padding", "padding-right", "content"],
["$include desk", "$include palm"],
["$nested-blocks"]

]}

Before:

.panel {
    position: absolute;
    top: 0;
    left: 0;
    &__inner {
        padding: 0 8px 0 20px;
        &:before {
            content: "";
        }
    }
    &__close {
        display: block;
    }
}

After (added two empty lines):

.panel {
    position: absolute;
    top: 0;
    left: 0;

    &__inner {
        padding: 0 8px 0 20px;

        &:before {
            content: "";
        }
    }
    &__close {
        display: block;
    }
}

Before:

.panel {
    position: absolute;
    top: 0;
    left: 0;

    @include palm {
        position: relative;
    }

    &__inner {
        padding: 0 8px 0 20px;

        @include desk {
            margin: 0 3.5%;
        }
        @include palm {
            padding-right: 20px;
        }
    }
    &__close {
        display: block;
    }
}

After (added one empty line):

.panel {
    position: absolute;
    top: 0;
    left: 0;

    @include palm {
        position: relative;
    }

    &__inner {
        padding: 0 8px 0 20px;

        @include desk {
            margin: 0 3.5%;
        }
        @include palm {
            padding-right: 20px;
        }
    }
    &__close {
        display: block;
    }
}

@atadams
Copy link

atadams commented Aug 12, 2015

👍

1 similar comment
@BorodinDK
Copy link
Contributor

+1

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

No branches or pull requests

7 participants