Heil Programmierung
Heil Programmierung

Reputation: 187

node-sass invalid CSS

Does node-sass even support @use ? Since I'm getting this error:

SassError: Invalid CSS after "...t-family: fonts": expected expression (e.g. 1px, bold), was ".$roboto;"

Here's the code of Nav.scss:


.nav {
  width: 100%;
  font-family: fonts.$roboto;

  &__item {
    margin-bottom: 10px;
    font-size: variables.$a;

    &_active {
      color: rgb(37, 133, 34);
    }
  }

  &__item:last-child {
    margin-bottom: 0px;
  }
}

Here's the code of fonts.scss:

$roboto: 'Roboto';

Here's the file structure

Upvotes: 1

Views: 2510

Answers (1)

Nathelol
Nathelol

Reputation: 597

The syntax is incorrect for node-sass.

You have defined the font variable correctly in fonts.scss but you need to import the font file into your Nav.scss file if you haven't already with:

@import "PATH/fonts.scss";

You then just need to reference the variable like so:

font-family: $roboto;

Upvotes: 1

Related Questions