Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Bug with nesting #389

Closed
Closed
@sc0rp10

Description

@sc0rp10

Hi, I found strange bug that I cannot reproduce in playground.
I have following foo.css:

.foo {
    color: #000;
    &__bar {
        color: #aaa;
    }

    &__baz {
        color: #bbb;

        &:hover {
            color: #ccc;
        }
    }
}

And next gulpfile.js:

const gulp = require("gulp");
const postcss = require("gulp-postcss");

gulp.task('css', function () {
    return gulp.src('foo.css')
        .pipe( postcss([ require('postcss-cssnext') ]) )
        .pipe( gulp.dest('build/') );
});

package.json:

{
  "dependencies": {
    "gulp": "^3.9.1",
    "gulp-postcss": "^7.0.0",
    "postcss-cssnext": "^2.11.0"
  }
}

I expect:

.foo {
    color: #000
}
.foo__bar {
    color: #aaa
}
.foo__baz {
    color: #bbb
}
.foo__baz:hover {
    color: #ccc
}

But I found:

.foo__baz {
        color: #bbb;

        &:hover {
            color: #ccc;
        }
}.foo {
    color: #000
}

.foo__bar {
        color: #aaa;
}

What am I doing wrong?
Can you please help me with the right setup?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions