2017-04-20 20 views
0

に5アプリを動作していない、私はアドバイスどおりRuby on Rails Bootstrap Glyphicons not workingに... ...私application.sassファイルにブートストラップGlyphiconsは私のRailsではRailsの

/* 
*= require bootstrap-sass-official 
... 
*/ 

@font-face 
    font-family: 'Glyphicons Halflings' 
    src: url('/assets/glyphicons-halflings-regular.eot') 
    src: url('/assets/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('/assets/glyphicons-halflings-regular.woff') format('woff'), url('/assets/glyphicons-halflings-regular.ttf') format('truetype'), url('/assets/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg') 

これを持っています。 Chromeコンソールでこのエラーが発生する:Failed to decode downloaded font: http://localhost:3000/assets/glyphicons-halflings-regular.woffetc..さまざまなフォント形式があります。

私はRails資産fontsフォルダに何かを置く必要がありますか?もしそうなら、具体的には何ですか?これに助けてくれてありがとう。

答えて

1

アプリケーションがRails 5であるため、フォントをapp/assets/fontsというフォルダに配置することをお勧めします。

あなたが外fontsフォルダをそれらを配置する場合は、以下の構成を追加する必要があります:

config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/

をしてから言及

@font-face { 
    font-family: 'Glyphicons Halflings'; 
    src: url('/assets/glyphicons-halflings-regular.eot'); 
    src: url('/assets/glyphicons-halflings-regular.eot?iefix') format('eot'), 
     url('/assets/glyphicons-halflings-regular.woff') format('woff'), 
     url('/assets/glyphicons-halflings-regular.ttf') format('truetype'), 
     url('/assets/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); 
} 
+0

わかりました、感謝としてURLを使用することができますそんなに!出来た! – Matt

+0

@Mattは助けてうれしい! SOさんのおかげ - それがうまくいけば答えの答えとしてマークされました;) – idej

+0

グリフィス4でRails 4に違いがあったかどうか知っていますか? – Matt