LESS compile error on retina media query

2019-06-28 05:20发布

问题:

I am unable to compile my LESS document because its returning a compile error on for this:

@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) { 

Can anyone see any reason this is happening? I can't see any errors in the code.

Update

I am using SimpLESS to compile. I just checked and it uses LESS 1.3.0.

回答1:

This appears to be a version issue. When checked on the various versions here, it has no issues from LESS 1.3.1+. However, for 1.3.0 it appears to choke at three points:

@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;}
}


标签: css less