5


*.eot?iefixを含む Compass font-face mixin を使用しようとしています。

私の app/assets/fonts には、.eot を含む、必要なすべてのフォント タイプが含まれています。

assets:precompile を実行しようとすると、次のようなメッセージが表示されてタスクが失敗します: webfont.eot?iefix はプリコンパイルされていません

この問題の可能な解決策を知っていますか?

config.assets.compile = true の場合はエラーなしで実行されますが、私が理解しているように、本番環境では使用しない方がよいでしょう。

4

3 に答える 3

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;
}
于 2011-11-23T14:58:28.463 に答える
4

ちょっとした (サポートされている) ハックでこの問題を解決しました。

新しい css ファイルを作成し、宣言のfont.css.erb場所に配置しました。@import "font"@font-face

@font-face {
    font-family: 'SketchBlockBold';
    src: font_url('font/sketch_block-webfont.eot');
    src: url('<%= asset_path('font/sketch_block-webfont.eot')+"?#iefix" %>') format('embedded-opentype'),
         font_url('font/sketch_block-webfont.woff') format('woff'),
         font_url('font/sketch_block-webfont.ttf') format('truetype'),
         url('<%= asset_path('font/sketch_block-webfont.svg')+"#SketchBlockBold" %>') format('svg');
    font-weight: normal;
    font-style: normal;
}

アセット パスの使用と、特殊なファイルの末尾の連結に注意してください。

于 2011-10-12T13:04:22.663 に答える
1

既知の問題のようですhttps://github.com/rails/rails/issues/3045 今のところ config.assets.compile = true を使用しています。

于 2011-10-10T11:37:13.767 に答える