Sass Invalid CSS Error: “expected expression”

2019-01-04 02:49发布

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...

What have I done wrong?

Sass Version: 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:

/* style.scss */
#navbar {
  width: 80%;
  height: 23px;
}

标签: css sass
2条回答
可以哭但决不认输i
2楼-- · 2019-01-04 02:52

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.

Sass and Scss use two different and incompatible syntaxes.

查看更多
Melony?
3楼-- · 2019-01-04 03:13

Try this:

/* style.scss */
#navbar {
    width: 80%;
    height: 23px;
}

/* style.sass */
#navbar 
    width: 80%
    height: 23px
查看更多
登录 后发表回答