我需要一些帮助来尝试将变量编译到主 sass。我创建了一个带有变量的文档 sass,并将此文档编译为主 sass:@import "../sass/helpers/_variables.scss"在该文档中声明了一些变量,如颜色、字体等。好吧,当我尝试在其他文件sass中调用一些变量(编译到main),SASS终端告诉我这个问题:
"status": 1,
"file": "C:/Users/Rafager/Desktop/Inmobiliaria web/sass/desing/_header.scss",
"line": 50,
"column": 22,
"message": "Undefined variable: \"$microsoft-regular\".",
"formatted": "Error: Undefined variable: \"$microsoft-regular\".\n on line 50 of sass/desing/_header.scss\n from line 9 of sass/main.scss\n>>
font-family: $microsoft-regular;\r\n ---------------------^\n"
}
Note: The fonts is declared in other document called and called in the main: @import "../sass/bases/_fonts.scss" and this is the code:
@font-face {
font-family: "Microsoft YaHei UI Regular";
src: url("../../fonts/msyh.ttc");
}
@font-face {
font-family: "Microsoft YaHei UI Bold";
src: url("../../fonts/msyhbd.ttc");
}
@font-face {
font-family: "Microsoft YaHei UI Light";
src: url("../../fonts/msyhl.ttc");
}```
¿Could you help me please?-
最佳答案
您需要说明 $microsoft-regular 是什么。
在你的变量中设置字体名称如下:
$microsoft-regular: 'Microsoft YaHei UI Regular';
$microsoft-bold: 'Microsoft YaHei UI Bold';
$microsoft-light: 'Microsoft YaHei UI Light';
关于css - 变量sass的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59323765/