资产管道,指南针font-face和eot?iefix调用字体

lyu*_*uba 5 font-face ruby-on-rails-3.1 sprockets asset-pipeline compass-sass

我正在尝试使用Compass font-face mixin,其中包含
*.eot?iefix

我的app/assets/fonts包含所需的所有字体类型,包括.eot.

当我尝试运行资产时:预编译任务失败说类似:webfont.eot?iefix未预编译

你知道这个问题的可能解决方案吗?

如果我有config.assets.compile = true,它运行时没有错误,但正如我所知,最好不要在生产中使用它.

Aar*_*ter 10

你也可以用纯Scss做到这一点:

@font-face {
  font-family: 'DroidSans';
  src: url(font-path('DroidSans-webfont.eot'));
  src: url(font-path('DroidSans-webfont.eot') + '?#iefix') format('embedded-opentype'),
       url(font-path('DroidSans-webfont.woff')) format('woff'),
       url(font-path('DroidSans-webfont.ttf')) format('truetype'),
       url(font-path('DroidSans-webfont.svg') + '#DroidSansRegular') format('svg');
  font-weight: normal;
  font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)


lyu*_*uba 1

似乎是一个已知问题https://github.com/rails/rails/issues/3045 现在使用 config.assets.compile = true 。