I’ve a SCSS map in a file known as ‘_colors.scss’ which I wish to name it from one other file known as ‘app.scss’. I’ve tried some strategies however I can´t discover the precise approach.
That is my ‘_colors.scss’ file:
/* Features */
@perform coloration($elem, $variant) {
@return map-get(map-get($coloration, $elem), $variant);
}
/* Variables */
$colours: (
textual content: (
1: #162c5b,
2: #565678,
3: #ababc9,
gentle: #718097,
footer: #ff2a91,
1i: #fff,
),
bg: (
hero: #038aff,
awards: purple,
options: #5ccaa7,
instruments: #febd3d,
3: #d2daf0,
infinite: #161348,
footer: #161348,
line-footer: #2f2c5b,
pink: #f1ecfd,
white: #fff,
),
);
And that is my ‘app.scss’ file the place I wish to name it from, but it surely doesn’t appear to name the map, so I can use it in my scss file, like I’m doing with the background coloration of the ‘.field’ class. What am I lacking?
@use 'colours' as cl;
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
physique {
font-family: "Inter", sans-serif;
}
.hero {
width: 100%;
.container {
margin: 0 auto;
padding: 90px 0;
width: min(1200px, 100%);
.field {
width: 300px;
peak: 300px;
padding: 28px;
background-color: coloration(bg, hero);
h2 {
font-size: 2rem;
padding-bottom: 20px;
font-weight: 800;
}
p {
font-size: 0.9rem;
font-weight: 400;
coloration: coloration(textual content, 1);
}
}
}
}