Sass 无效 CSS 错误:“预期表达式”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7745855/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sass Invalid CSS Error: "expected expression"
提问by Tom R
I've just been following the Sass tutorial. For some reason though the Sass file is not correctly generating the css. The terminal says the css is invalid but I'm pretty sure it's not. I've tried changing it too just in case there was a problem...
我一直在关注Sass 教程。出于某种原因,虽然 Sass 文件没有正确生成 css。终端说 css 无效,但我很确定它不是。我也尝试过更改它,以防万一出现问题...
What have I done wrong?
我做错了什么?
Sass Version: Sass 3.1.10
Sass 版本:Sass 3.1.10
Error message:
错误信息:
error sass/test.sass (Line 3: Invalid CSS after "80%":
expected expression (e.g. 1px, bold), was ";")
.sass file contents:
.sass 文件内容:
/* style.scss */
#navbar {
width: 80%;
height: 23px;
}
回答by meagar
Based on your error message (error sass/test.sass
) I can tell you're using the .sass
extension for a Scss file. Change your file name to style.scss
.
根据您的错误消息 ( error sass/test.sass
),我可以告诉您正在使用.sass
Scss 文件的扩展名。将文件名更改为style.scss
.
Sass and Scss use two different and incompatible syntaxes.
Sass 和 Scss 使用两种不同且不兼容的语法。
回答by lincolnge
Try either:
尝试两种:
/* style.scss */
#navbar {
width: 80%;
height: 23px;
}
Or:
或者:
/* style.sass */
#navbar
width: 80%
height: 23px
Note the difference in file extension and syntax.
请注意文件扩展名和语法的差异。