V
V
Vasya2016-10-17 17:21:41
Sass
Vasya, 2016-10-17 17:21:41

SCSS class inside a function?

Greetings.
Is it possible to do this with scss:

@mixin some-name($class) {
    $class {
        prop: value;
    }
    $class:after {
        prop: value;
    }
}

those. I need to be able to include this mixin/function in any class so that I can write a class in the parameter that will be substituted in the function body.
The task is to add a certain set of properties with pseudo-selectors to a large number of blocks. I would like to automate all this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2016-10-17
@w3cproject

What you want can be implemented in a simpler and more logical way:

@mixin someName {
    prop: value;

    &::after {
        prop: value;
    }
}

.some-class {
    @include someName;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question