Mixin in SCSS (properties of a class inside another one)

Viewed 37

In LESS I could write something like:

.foo {
    color: red;
}

.boo {
    .foo();
    background: blue;
}

To "include" properties of .foo class into .boo one.

What is the easiest and clean way to obtain a similar beaviour in SCSS?

1 Answers

How about trying like this,

mixins.scss

@mixin flex($x: center, $y: center) {
    display: flex;
    align-items: $x;
    justify-content: $y;
}

custom.scss

.classname {
    @include flex(flex-start, space-between);
    color: red;
}

Use @include

Related