简体   繁体   English

我正在尝试将SCSS代码编译为CSS,但未找到变量

[英]I'm trying to compile my SCSS code into CSS but the variables are not found

I'm trying to set a page with a package.json file I just build to compile my Sass into CSS but when compiling it says my variables are not found. 我正在尝试设置一个页面,其中包含我刚刚构建的package.json文件,用于将Sass编译为CSS,但是在编译时会显示找不到我的变量。 Probably it's something very stupid but I can't see why not. 也许这很愚蠢,但我不明白为什么不这样做。

This is my json file 这是我的json文件

    "watch:sass": "node-sass --watch sass/main.scss css/style.css ",
    "devserver": "live-server",
    "start": "npm-run-all --parallel devserver watch:sass",
    "compile:sass": "node-sass sass/main.scss css/style.comp.css",
    "prefix:css": "postcss --use autoprefixer -b 'last 10 versions' css/style.comp.css -o css/style.prefix.css",
    "compress:css": "node-sass css/style.prefix.css css/style.css --output-style compressed",
    "build:css": "npm-run-all compile:sass prefix:css compress:css"
  },`

This is my main.scss 这是我的main.scss

@import "nav";
@import "base";

And this is my _base.scss 这是我的_base.scss

$text-dark: #2c2c2c;
$background-extra-dark: #6B7883;
``

Oh, nevermind. 哦,没关系。 I know why. 我知道为什么。

Always import the variables first! 始终首先导入变量!

@import "base";
@import "nav";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM