matype / stylefmt

stylefmt is a tool that automatically formats stylesheets.
Other
2.1k stars 89 forks source link

Nested selectors wrong indention #137

Closed frux closed 8 years ago

frux commented 8 years ago

I have some css. And this is what I expected form stylefmt:

.y-photo-grid
{
    display: flex;
    width: 100%;
    margin: 0;
    padding: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;

    &__row
    {
        display: flex;
        width: 100%;
        margin: 0;
        padding: 0;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }

    &__item
    {
        display: block;
        margin: 0;
        background: #eee;

        &:first-child
        {
            margin-left: 0;
        }
    }

    &__link
    {
        display: block;
        height: 100%;
        width: 100%;
    }

    &__image
    {
        width: 100%;
        height: 100%;
    }
}

But what I've got:

.y-photo-grid
{
    display: flex;
    width: 100%;
    margin: 0;
    padding: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;

    &__row
{
        display: flex;
        width: 100%;
        margin: 0;
        padding: 0;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }

    &__item
{
        display: block;
        margin: 0;
        background: #eee;

        &:first-child
{
            margin-left: 0;
        }
    }

    &__link
{
        display: block;
        height: 100%;
        width: 100%;
    }

    &__image
{
        width: 100%;
        height: 100%;
    }
}

Does stylefmt support nested selectors?

matype commented 8 years ago

@frux Do you use stylefmt with stylelint? If that is the case, please show me your stylelint configuration file.

frux commented 8 years ago

@morishitter I don't use stylelint but I have the following stylelint.config.js:

module.exports = {
    rules: {
        'block-opening-brace-newline-before': 'always',
        'block-opening-brace-newline-after': 'always',
        'indentation': 4
    },
    ignoreFiles: [
        './static',
        './bemy.templates'
    ]
};
matype commented 8 years ago

I see, thank you. I will fix it :)