Overriding Sass Variables

I have a Sass file that performs several import operations as follows

@import("variables") @import("custom-variables") @import("widgets") @import("custom-styles") 

I declare a variable called $ promoBoxColor, for example, in both variables and user variables, and then widgets and custom styles refer to this variable.

I found that the color defined in variables is used if I try to use it in custom styles, and not in the color defined in custom variables.

Is it possible to override variables this way in Sass? This seems like normal if I just override the color used in widgets.

+4
source share
1 answer

Thanks for answers. The best way to do this is to set all the variables in the main variable file to default and then declare the user variables first.

+3
source

Source: https://habr.com/ru/post/1485474/


All Articles