简体   繁体   English

将 SCSS 变量文件导入 CSS 模块文件

[英]Importing SCSS variables file into CSS module file

I'm trying to import _variables.scss file into a CSS module file to use variables to specify the colors.我正在尝试将_variables.scss文件导入 CSS 模块文件以使用变量来指定 colors。

_variable.css file: _variable.css文件:

$mainBlack: #000000;

navigation.module.css file: navigation.module.css文件:

@import "../../../commonStyles/_variables.scss";

.Navigation {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: auto;
background-color: $mainBlack;
}

Anybody knows why the color is not being imported and I can't access the $mainBlack color?有人知道为什么没有导入颜色并且我无法访问$mainBlack颜色吗? I've tried using @use but this approach still doesn't work.我试过使用@use ,但这种方法仍然行不通。

You will need to make your changes on the.scss file, make sure that everything is referenced and then compile your app.scss into app.css.您需要对 .scss 文件进行更改,确保引用了所有内容,然后将您的 app.scss 编译为 app.css。 You will need either SASS or Grunt to compile your.scss files.您将需要 SASS 或 Grunt 来编译 your.scss 文件。

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

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