質問

ブートストラップサスレールを使用しています この問題 そして、生産モードでRailsプロジェクトを実行すると、3x 404エラーが発生します。

GET http://localhost:3000/assets/twitter/bootstrap/glyphicons-halflings-regular.woff 404 (Not Found) assets/twitter/bootstrap/glyphicons-halflings-regular.woff:1
GET http://localhost:3000/assets/twitter/bootstrap/glyphicons-halflings-regular.ttf 404 (Not Found) assets/twitter/bootstrap/glyphicons-halflings-regular.ttf:1
GET http://localhost:3000/assets/twitter/bootstrap/glyphicons-halflings-regular.svg 404 (Not Found) 

Rake Assetsを使用しました:Precompile Rails_Env =生産結果を伴う静的ファイルを生成します。

I, [2013-11-07T16:52:25.269370 #12948]  INFO -- : Writing myproject/public/assets/application-3517eb39b597107b3dbccbcbf4f0b3cc.js
I, [2013-11-07T16:52:25.315358 #12948]  INFO -- : Writing myproject/public/assets/application-1459bfe79a6477170658d53257e4a8fd.css
I, [2013-11-07T16:52:25.334356 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-8b1bdc16b9e098d67afebbf8d59fcea7.eot
I, [2013-11-07T16:52:25.345360 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-8d8305e5b6a807076d3ec68e2f190674.svg
I, [2013-11-07T16:52:25.357360 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-946071b70245967633bb3a774c60f3a3.ttf
I, [2013-11-07T16:52:25.367360 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-d7e2274ad1d940a0b2ce7480810ab223.woff
etc ...

これらの3つのフォントファイルを除き、すべての資産は正常に機能しています。私は一日中検索しましたが、何も見つかりませんでした。 Railsはこれらの3つのファイルのハッシュなしでバージョンを探しているようですが、Rakeはハッシュでそれらを生成します

私のconfig/production.rb:

  config.cache_classes = true
  config.eager_load = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_assets = true
  config.assets.js_compressor = :uglifier
  config.assets.compile = false
  config.assets.digest = true
  config.assets.version = '1.0'
  config.log_level = :info
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify

編集

@font-face変数をオーバーライドしようとしましたが、古い変数を削除しないようです。

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

私は現在、グリフィコンをロードしていますが、それでも3x 404エラーです。

役に立ちましたか?

解決

それでは、そうです。

に切り替えました https://github.com/thomas-mcdonald/bootstrap-sass 。かなり同じブートストラップバージョンで、問題ありません。

更新を編集します

Bootstrap-Sassが更新されました。 404エラーがある場合は、GitHubページで説明されているように、いくつかの変更を加える必要があります。

他のヒント

同じ問題がありました。追加しなければならなかったことが判明しました @import "bootstrap-sprockets" に加えて @import "bootstrap" 中身 application.css.sass.

Webサーバーにmimeタイプを追加します。

Woffファイルを提供する方法を定義する必要があります。

IISについては、IISに移動して鉱山タイプのウィンドウを開きます

追加]をクリックして入力します」woff「最初の入力ボックスと」アプリケーション/X-Font-Woff「セカンドボックス用

次に、他の拡張機能について繰り返します

幸運を

Fontディレクトリは、Asset Directoryとして自動的に表示されません。設定して明示的に追加する必要があります。 config.assets.paths << Rails.root.join("app", "assets", "fonts") の中に application.rb ファイル。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top