A
A
Alexey Nikolaev2017-09-06 15:12:02
Sass
Alexey Nikolaev, 2017-09-06 15:12:02

How good is the solution to work with scss as a PL?

Good day.
The bottom line: the site has blocks of different colors, the color of the text and elements in them depends on the background color. I came up with the idea to make color schemes, and use something like this:

.block {
    @include color-scheme-ocean();

    &__element {
        // свойство, специфичное только для .block, но входящее в цветовую схему
       color: for-color-scheme-ocean(color);
    }
}

Actually, the implementation of the mixin and function shown above refers to the $color-schemes list variable, which describes all the color relationships. I liked this approach, and I would even extend it to the entire project - I would take the implementation of all blocks into mixins, and my specific values ​​would be returned by functions. That is, the actual scss code of the project would be a minimum of the styles themselves - they would be described in mixins.
How good is this idea? Is this used in real projects? I have not seen this in any framework, in any article, usually scss code is similar to css, and not to a programming language with multiple function calls. It is unlikely that I came up with something revolutionary new, therefore, they have already come to this and, apparently, they have refused. Why?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kiryushka Tsisar, 2017-09-06
@carlcox

In the end, you will still have pure CSS, this will help you in development.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question