私は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/
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
ファイルを追加する必要があり
おっとは、これを追加するのを忘れ。私は今こうしましたが、 'woff2、woff、ttf'に関連したエラーをまだ受けています。 – Nappstir
あなたがリストアップした5つのフォントファイルのすべてが 'vendor/assets/fonts'にあることを再確認しましたか? –
はい、5つのファイルがすべてあります。あなたが見てみたい場合のために私のレポがあります:https://github.com/Nappstir/my_family – Nappstir