css - 错误 "Invalid CSS after\"...线性梯度 (\": expected selector, was\"{\"",

标签 css npm sass compilation

尝试编译 sass 我得到这个错误:(找不到错误的语法:)

/* {
   "status": 1,
   "file": "C:/Users/faido/Desktop/Productivity/sass 
   css/project/sass/main.sass",
   "line": 36,
   "column": 9,
   "message": "Invalid CSS after \"...inear-gradient(\": expected selector, 
   was \"{\"",
   "formatted": "Error: Invalid CSS after \"...inear-gradient(\": expected 
   selector, was \"{\"\n        on line 36 of sass/main.sass\n>>         
   linear-gradient( {\n\n   --------^\n"
   }
*/

对于这段代码:

.header 
    background-image: linear-gradient( 
        to right bottom, 
        rgba( $color-primary-light, 0.8 ), 
        rgba( $color-primary-dark, 0.8 )
    ),
    url(../img/hero.jpg)

非常感谢任何帮助/见解

最佳答案

Sass 的缩进语法 unfortunately does not support multiline expressions .

要修复它,您必须将所有内容放在一行中:

.header 
    background-image:  linear-gradient(to right bottom, rgba($color-primary-light, 0.8), rgba($color-primary-dark, 0.8)) url(../img/hero.jpg)

关于css - 错误 "Invalid CSS after\"...线性梯度 (\": expected selector, was\"{\"",,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58613601/

相关文章:

css - 使用 Javascript 获取浏览器历史记录?

html - 使用 flexbox 对齐元素中心的拉伸(stretch)高度

node.js - package.json 中的 "All Rights Reserved"许可证

css - 如何使用:before with svg and left floating

javascript - 如何使用 CSS/Jquery 将 'div' 转换为下拉列表

javascript - 将 Accordion slider 更改为向上滚动而不是向下滚动

node.js - React-native:看起来你在全局安装了 react-native

node.js - 无法在 Windows 7 中安装 npm 包 PM2

html - 增加屏幕高度时,子 block 必须超出父 block

sass - Jekyll不会使用 `jekyll serve`编译scss文件