Sass SCSS地图赢得';不能用罗盘编译

Sass SCSS地图赢得';不能用罗盘编译,sass,compass-sass,Sass,Compass Sass,我已经编写了一个SCSS映射变量和一个@each循环来为文件下载链接分配不同的图标,如下所示 $file-icons: ( "application/vnd.ms-excel": "../images/ico-excel.png", "application/pdf": "../images/ico-pdf.png", "image/tiff": "../images/ico-img.png", "image/gif": "../images/ico-img.png", "image/png":

我已经编写了一个SCSS映射变量和一个
@each
循环来为文件下载链接分配不同的图标,如下所示

$file-icons: (
"application/vnd.ms-excel": "../images/ico-excel.png",
"application/pdf": "../images/ico-pdf.png",
"image/tiff": "../images/ico-img.png",
"image/gif": "../images/ico-img.png",
"image/png": "../images/ico-img.png",
"image/jpeg": "../images/ico-img.png",
"application/x-shockwave-flash": "../images/ico-flash.png",
"audio/mpeg": "../images/ico-audio.png"
);

@each $file in $file-icons {
  img[title="#{nth($file, 1)}"] + a:hover {
    background: url("#{nth($file, 2)}") right top no-repeat;
  }
}
当我对其进行测试时,它的编译完全符合我的预期:

img[title="application/vnd.ms-excel"] + a:hover {
  background: url("../images/ico-excel.png") right top no-repeat;
}

img[title="application/pdf"] + a:hover {
  background: url("../images/ico-pdf.png") right top no-repeat;
}

img[title="image/tiff"] + a:hover {
  background: url("../images/ico-img.png") right top no-repeat;
}

img[title="image/gif"] + a:hover {
  background: url("../images/ico-img.png") right top no-repeat;
}

img[title="image/png"] + a:hover {
  background: url("../images/ico-img.png") right top no-repeat;
}

img[title="image/jpeg"] + a:hover {
  background: url("../images/ico-img.png") right top no-repeat;
}

img[title="application/x-shockwave-flash"] + a:hover {
  background: url("../images/ico-flash.png") right top no-repeat;
}

img[title="audio/mpeg"] + a:hover {
  background: url("../images/ico-audio.png") right top no-repeat;
}
我在用指南针做这个项目。当我使用compass compile时,我得到以下错误

user@machine:~/project$ compass compile
    error sass/style.scss (Line 2 of sass/_partial.scss: Invalid CSS after "...n/vnd.ms-excel"": expected ")", was ": "../images/ic...")
   create stylesheets/style.css

我不确定是什么导致了这个错误。这可能与新地图对Sass的支持程度有关,也许Compass还没有完全支持它?

您使用的是什么版本的Compass/Sass?地图在Sass 3.3中是新的,它仅受Compass 1.0预发布版的支持
gem安装compass--pre
以获取最新版本

Compass的当前稳定版本(0.12.2版)于2012年6月发布,因此它不支持Sass v3.3.0的新地图功能。(SassMesister目前正在使用Compass的v1.0.0.18版本,这就是您的Sass在那里编译的原因。)

安装Compass的最新测试版:

gem install compass --pre

这是版本1.0.0.alpha.19(2014年3月)。

感谢您确认我的怀疑并提供解决方案!奇怪的东西。它在另一台机器上为我工作,但不是在这台机器上。我很确定,我总是用同样的方法安装指南针。谢谢你给我指明了正确的方向!更新。看起来Bundler安装的Compass版本要比gem安装的版本更新。