Retina媒体查询中的LESS编译错误

4

我无法编译我的LESS文档,因为它返回了以下编译错误:

@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { 

有人知道为什么会出现这种情况吗?我没有在代码中发现任何错误。

更新

我正在使用SimpLESS进行编译。我刚刚检查了一下,它使用的是LESS 1.3.0。


3
编译错误是什么?它们通常会告诉你问题出在哪里... - BenM
1
这可能是你的问题:(min-resolution: 2dppx)你想写dpi还是px?尝试更正一下。 - Caelea
1
@Caelea dppx是一个有效的单位(参见:http://www.w3.org/TR/css3-values/#resolution)。如果LESS对此有问题,那么这是LESS本身的问题。 - cimmanon
@BenM - 没有编译错误,只是在这一行上显示语法错误。 - ccdavies
@freejosh - 刚刚更新了我的帖子,1.3.0版,SimpLESS似乎没有更新。 - ccdavies
显示剩余2条评论
1个回答

6
这似乎是一个版本问题。在这里检查了各个版本(链接)后,从LESS 1.3.1+开始就没有问题了。然而,在1.3.0中,它似乎会在三个地方出现问题:
@media only screen and (-webkit-min-device-pixel-ratio: 2), 
  only screen and (min--moz-device-pixel-ratio: 2), 
  only screen and (-o-min-device-pixel-ratio: 2/1), //<-HERE on the 2/1
  only screen and (min-device-pixel-ratio: 2), 
  only screen and (min-resolution: 192dpi), //<-HERE on the dpi
  only screen and (min-resolution: 2dppx) //<-HERE on the dppx
{ 
  .test { color: red;}
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接