In my Angular test project, I'm experimenting with using the same colors repeatedly. To achieve this, I created a constants.css file where I defined all my root constants, which currently consist of colors. However, I've hit a roadblock when attempting to utilize these constants in the CSS files for individual components.
I attempted to include constants.css directly into the HTML file but was unsuccessful. I tried both @import url("constants.css") and @import "constants.css", but neither method worked as expected.
Here is an excerpt from the constants.css file:
:root {
--primary-color: #2c3e50;
--secondary-color: #f1c40f;
--background-color: #ecf0f1;
--accent-color: #c0392b;
}
And here is a snippet from the nav.component.css file:
@import url("../../../constants.css");
a.logo {
color: var(--secondary-color);
}
Despite expecting the text of my logo to be yellow, it remains the default black color.