css - 为什么我的 scss 不采用通用选择器?
问题描述
我正在学习 Sass,我选择尝试使用 Scss 语法,但是当我尝试将 scss 代码编译为 css 时出现错误。
这是命令行的错误:
> starter@1.0.0 compile:sass C:\Users\xxx
> node-sass sass/main.scss css/style.css
{
"status": 1,
"file": "C:/Users/xxx/sass/main.scss",
"line": 14,
"column": 1,
"message": "Invalid CSS after \"*\": expected expression (e.g. 1px, bold), was \",\"",
"formatted": "Error: Invalid CSS after \"*\": expected expression (e.g. 1px, bold), was \",\"\n
on line 14 of sass/main.scss\n>> *,\r\n ^\n"
}
这是我的 Scss 文件:
*,
*::after,
*::before {
margin: 0;
padding: 0;
box-sizing: inherit;
}
html{
font-size: 62.5%;
}
body{
font-family: "Lato", sans-serif;
font-weight: 400;
font-size: 1.6rem;
line-height: 1,7;
color: #777;
padding: 3rem;
box-sizing: border-box;
}
我正在通过 Package.json 运行它:
{
"name": "starter",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"compile:sass": "node-sass sass/main.scss css/style.css"
},
"author": "",
"license": "ISC",
"devDependencies": {
"node-sass": "^4.14.1"
}
}
出于某种原因,它说通用选择器不是 Css 代码,我尝试通过将该选择器注释掉,但它对 html 选择器说同样的话。
-------UPDATE------- 一旦我使用了 7-1 css 架构,错误就停止了。当我将通用选择器放在另一个文件中时,它被接受了,所以问题得到了解决,但我不知道为什么。
解决方案
推荐阅读
- r - 将两列组合成第三列作为R中的列表
- maven - Maven Jar 中缺少 JavaDoc
- gprs - 在SIM800上,“at+sapbr”命令与“at+cstt”、“at+ciicr”等有什么区别?
- c# - 如何将多个值与单个变量进行比较?
- javascript - 在正则表达式模式验证 JavaScript 中允许逗号后有空格
- javascript - React useCallback with debounce works with old value, how to get actual state value?
- mongodb - 如何调试 mongodb 慢速正则表达式查询?
- android - 无法构建 Android Cordova 项目(Ionic 5)
- javascript - 模块构建失败 - 导入后未找到 ESLint 配置
- powerbi - PowerBI/DAX - 总结组成员