SASS Invalid css error

2020-03-30 06:57发布

问题:

I just started with sass and installed prepros. I tried to compile an .scss file and got an error:

Syntax error: Invalid CSS after " color: ": expected expression (e.g. 1px, bold), was "@blue;"

The .scss code:

.footer {
clear: both;
background-color: @blue;

}

I installed Ruby, and prepros.

回答1:

SCSS uses $ to denote variables so it should be background-color: $blue;



回答2:

It looks like your syntax is wrong. In Sass, @ is for things like imports, media directives, partials (includes) and extends.

If you want to define a specific value for blue, and then reuse it, then the syntax is something like this:

$blue: #3333FF;

a {
    font-weight: bold;
    color: $blue;
}


标签: ruby sass