运行Compass 0.12.7(Alnilam)我重复多次遇到此错误:
Running "compass:dev" (compass) task
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
Cannot determine the opposite position of: to
unchanged public/styles/sass/ie_only.scss
unchanged public/img/icons-s6ab39d30ab.png
overwrite public/styles/css/screen.css (2.484s)
我接受它的渐变是错误的,但这里出了什么问题,我该如何缓解这个问题呢?
答案 0 :(得分:2)
我使用指南针0.12.7在我的项目中遇到了同样的问题,并且不可避免地只能通过更新指南针来解决问题。使用位置值为linear-gradient
的{{1}} mixin时会出现问题警告,如下例所示:
to right
这会编译成这样的东西(在你的问题中抛出错误):
div {
@include background(linear-gradient(to right, red, blue));
}
不幸的是,这是无效的CSS代码。正确的输出应如下:
div {
background: -webkit-gradient(linear, to right, to left, color-stop(0%, #ff0000), color-stop(100%, #0000ff));
background: -webkit-linear-gradient(to right, #ff0000, #0000ff);
background: -moz-linear-gradient(to right, #ff0000, #0000ff);
background: -o-linear-gradient(to right, #ff0000, #0000ff);
background: linear-gradient(to right, #ff0000, #0000ff);
}
解决问题的唯一方法是更新指南针,正如我之前所说的那样。
答案 1 :(得分:0)
如果您不想更新您的sass,可以删除" to"属性。
默认的sass渐变是垂直的:
@include background(linear-gradient(red, blue));
要获得横向:
@include background(linear-gradient(90deg, red, blue));