user3808307
user3808307

Reputation: 1549

Importing variables scss

I am using scss for the first time

I created a file in src/styles/variables.scss

$background-color: #323132;

Then on src/components/MyComponent.module.scss

@use "src/styles/variables";

.content {
  background-color: variables.$background-color;  
}

And I get

SassError: Invalid CSS after "...olor: variables": expected expression (e.g. 1px, bold), was ".$background-color;"
        on line 14 of src/components/MyComponent.module.scss
>>   background-color: variables.$background-color;

I can't find what is wrong? thank you

Upvotes: 0

Views: 418

Answers (1)

Brian
Brian

Reputation: 556

Just import your variables instead and use directly

@import "src/styles/variables";

.content {
  background-color: $background-color;  
}

Upvotes: 1

Related Questions