1

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

9
  • completely wrong syntax. sass-lang.com/documentation/variables Commented Mar 22, 2021 at 14:56
  • 1
    where? It's completely right Commented Mar 22, 2021 at 15:07
  • 1
    @use is only supported by dart-sass - if you are using lib-sass or ruby-sass, that may be why you're getting that error. I believe node-sass uses lib. Here's a github issue: github.com/sass/node-sass/issues/2886 Commented Mar 22, 2021 at 15:25
  • 1
    @cloned it's under Built-in modules. sass-lang.com/documentation/variables#built-in-variables Commented Mar 22, 2021 at 15:26
  • 1
    @disinfor: If you or Programmer_007 manage to confirm your hypothesis, your comment should be good as an answer. Commented Mar 22, 2021 at 15:35

1 Answer 1

1

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; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.