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

Parameters to add empty lines before or after children rules and @rules #30

Closed
andrew--r opened this issue Jun 12, 2016 · 2 comments
Closed

Comments

@andrew--r
Copy link

Hello.

I'd like to have an ability to add empty lines before or after children rules and at-rules. Right now we can only specify number of empty lines between rules of similar type (like children or at-rules), but it's not too practical.

Instead of this:

.block {
    display: block;
    margin: auto;
    @media (max-width: 640px) {
        width: 100%;
    }

    @media (max-width: 1200px) {
        width: 90%;
    }
    &--modifier {
        background: red;
    }

    &--another-modifier {
        background: green;
    }
}

we should have something like this:

.block {
    display: block;
    margin: auto;

    @media (max-width: 640px) {
        width: 100%;
    }

    @media (max-width: 1200px) {
        width: 90%;
    }

    &--modifier {
        background: red;
    }

    &--another-modifier {
        background: green;
    }
}

I suggest to replace parameters empty-lines-between-media-rules and empty-lines-between-children-rules with empty-lines-before-media-rules, empty-lines-before-children-rules, empty-lines-after-media-rules, empty-lines-after-children-rules.

What do you think about it? I'd like to implement it and create a PR, if you don't mind.

@hudochenkov
Copy link
Owner

You can achieve desired result with this config:

{
    "sort-order": [
        [ "..." ],
        [ ">child" ],
        [ "@media" ]
    ],
    "empty-lines-between-children-rules": 1,
    "empty-lines-between-media-rules": 1
}

sort-order is array of arrays. Each array is a group and groups devided by empty line. There is no empty lines inside group, so empty-lines-between-children-rules and empty-lines-between-media-rules were added to fix this.

@andrew--r
Copy link
Author

Cool, thanks a lot!

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

2 participants