K
K
Kirill2021-11-06 14:47:34
Sass
Kirill, 2021-11-06 14:47:34

How to use external constants in SASS?

I have a BEM project, so I use modular SCSS.
I would like to store constants (like colors) in a separate file, and later connect it to other modules.
I created a separate _libary.scss file and import it with @use.
But when I try to connect the constant to the file (color: library.$primary-color;), I get an error

SassError: SassError: Invalid CSS after "    color: library": expected expression (e.g. 1px, bold), was ".$primary-color;"
        on line 9 of src/components/app/app.module.scss
>>     color: library.$primary-color;


The crux of the matter is: how do I use external constants?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question