2016-04-20 4 views
0

私のグリフィコンを私のRailsアセットパイプラインで動作させることができません。 stylesheets/application.sass、私が持っているでレールで部分的にしか機能しないブートストラップ - グリフコンが動作しない

...

@import "bootstrap-sprockets" 
@import "bootstrap" 
@import "glyphicons" 

私はbootstrap-sasssass-rails宝石stylesheets/glyphicons.css

、私が持っているを使用しています...

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

それはので、奇妙なこれは(下)正常に動作、私に赤い危険のボタンを与える...

<a class="detete btn btn-danger" href="#">x</a> 

...この1つは(下)私の灰色のデフォルトボタンや星のアイコンのいずれかを与えていない、動作しませんが...

<a class="btn" href="#"><i class="icon-star-empty"></i></a> 

私はブートストラップは、部分的にしか「働いていると言う理由です" 私のために。これについての助けがあれば幸いです。

+0

削除しないdetete – chiliNUT

答えて

1

application.jsに次の行を追加しましたか?ここではあなたのアプリケーションについて何も言及していません。私は、これはあなたがフォントフォルダに設定されたデフォルトGlyphiconsフォントディレクトリでは、以下のリンク https://github.com/twbs/bootstrap-sass

+0

私は実際に行ってきました。ありがとう。 – Matt

1

を確認することができますあなたの

//= require jquery 
//= require bootstrap-sprockets 

を助けることを願っています。代わりにasset_pathで定義する必要があります。ですので、app/assets/stylesheets/application.css.scsに下記のコードを追加してみてください。

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

さらにconfig/application.rbファイルを変更する必要があります。

config.assets.paths << "#{Rails}/vendor/assets/fonts" 
+0

これらの変更や追加をお勧めしましたが、それでも機能しません。また、なぜ灰色の「btn」も出てこない理由は分かりませんが、赤い「btn btn-danger」が出てきます。とても奇妙に思える。私は完全なブートストラップパッケージを持っていないと思っていますが、 'bootstrap-sass'という宝石を使っていればいいはずです。非常に奇妙な。ありがとう。 – Matt

関連する問題