2016-04-19 1 views
2

私はbootstraps glyphiconsを得ることに多くの問題を抱えてきました。ついに私は彼らを現場に出すことができました。私が今持っています唯一の問題は、私は私のDOMに次のエラーを取得することです:Railsブートストラップglyphicons

GET http://localhost:3000/fonts/glyphicons-halflings-regular.woff2      jquery.self-660adc5….js?body=1:3734 
GET http://localhost:3000/fonts/glyphicons-halflings-regular.woff      localhost/:1 
GET http://localhost:3000/fonts/glyphicons-halflings-regular.ttf 404 (Not Found)  localhost/:1 

私はjquery.self-660adc5...js?body=1:3734、私は次のコード行に取られます選択したときだけで誰もが、認識している:support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;

は私の端末では、私は以下のようになります。

Started GET "/fonts/glyphicons-halflings-regular.woff2" for ::1 at 2016-04-18 21:57:17 -0600 

ActionController::RoutingError (No route matches [GET] "/fonts/glyphicons-halflings-regular.woff2") 

私は現在vendor/assets/fonts/

内のすべてのブートストラップglyphiconファイルを持っています私が持っている私の application.cssフォルダで

:私は混乱していますどこ私は推測mime_types.rb

Rack::Mime::MIME_TYPES['.woff'] = 'application/x-font-woff' 

@import "bootstrap-sprockets"; 
@import "bootstrap"; 

@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'); 
} 
application.rb

config.assets.paths << "#{Rails}/vendor/assets/fonts" 
config.assets.precompile += %w(.svg .eot .woff .ttf .woff2) 

glyphiconsが現れているということで、しかし、私はまだ働いていますこれらのファイルが見つからないというDOMと私の端末のエラーです。どのように私はこれを処理することができます上の任意の提案?当初はgem 'bootstrap-sass', '3.2.0.0'がインストールされていましたが、最終的にはブートストラップパッケージに追加されてプロジェクトに追加されました。

残念ながら、私はまだこの問題を解決していません。今のところ私はブートストラップのCDNキーを含んでいます:

<!-- Latest compiled and minified CSS --> 
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> 
    <!-- jQuery library --> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> 
    <!-- Latest compiled JavaScript --> 
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 

これは明らかに今のところエラーを取り除きます。他の誰かが解決策を持っている場合や、この問題の解決方法に関する詳細情報が必要な場合は、コメントをしてください。私はあなたの考えを聞くのが最も熱心になるでしょう。あなたはまだアセットパイプラインへwoff2ファイルを追加する必要があり

答えて

1

+0

おっとは、これを追加するのを忘れ。私は今こうしましたが、 'woff2、woff、ttf'に関連したエラーをまだ受けています。 – Nappstir

+0

あなたがリストアップした5つのフォントファイルのすべてが 'vendor/assets/fonts'にあることを再確認しましたか? –

+0

はい、5つのファイルがすべてあります。あなたが見てみたい場合のために私のレポがあります:https://github.com/Nappstir/my_family – Nappstir

関連する問題