nucliweb
11/18/2014 - 12:01 PM

Sass combining parent using ampersand (&) with base element

Sass combining parent using ampersand (&) with base element

// SASS ----

.item {
    color: black;
    @at-root {
        a#{&} {
            color:blue;
        }
    }
}

// Can also be written
.item {
    color: black;
    @at-root a#{&} {
        color:blue;
    }
}

// Output CSS ----
.item {
    color: black;
}
a.item {
    color: blue;
}