7

package.json

"scripts": {
  "compile:sass": "node-sass sass/main.scss css/style.css -w"
}

main.scss

@import "abstracts/variables";
@import "base/typography";  

_variables.scss

$color-light-grey: #777;
$color-white: #fff;   

_typography.scss

body {
  color: $color-light-grey;
}
.heading-primary {
  color: $color-white;
}

Now my issue is when I'm trying to compile with npm run compile:sass it throws the following error:

"message": "Undefined variable: \"$color-light-grey\"."

1
  • variable vs. variables? Commented Nov 27, 2017 at 8:53

3 Answers 3

7

convert all file names with beginning "_"
example:
typography.scss >> to >> _typography.scss

Sign up to request clarification or add additional context in comments.

1 Comment

Please ensure that your answer improves upon the answer already present in this question.
3

Looks like there are two errors in your code above:

  • You import "abstracts/variables" but, at least in the text, the file name seems to be _variables.scss (missing an "s")
  • You should import "abstracts/variables" before everything else.

Like that:

@import "abstracts/variables";
@import "base/typography";

1 Comment

It works, but how I don't know. Is there any reason why that would make a difference? Is there needed to order file by priority?
0

Simply import everything in this order

 - abstracts
 - vendors
 - base
 - layout
 - components
 - pages
 - themes

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.