I have a scss file that I @import "./global-style/scss-variables";
in index.scss, with the following content:
:root {
--spacing: 8px;
--iphonewidth: 375px;
}
When I call a variable in the scss of one of my components, like margin-bottom: calc(#{var(--spacing)} * 2);
, 8px is inserted in the var(--spacing)
placeholder. However, var(--iphonewidth)
is not 375px as would've been expected, which is used here:
@media screen and (max-width: var(--iphonewidth)) {
....
}
I'm not sure why variables in sass behave this way. Maybe because variables may not be used in media queries?