[英]getting bootstrap-sass gem and rails to work with existing project
[英]Rails 4: Bootstrap-sass gem assets work on development but not on production
我有一個rails應用程序,我使用gem bootstrap-sass在我的本地機器上開發。 這一切在開發中都運行良好,但當我將我的應用程序部署到生產服務器時,glyphicons停止工作。
控制台中出現錯誤,指出:
downloadable font: download failed (font-family: "Glyphicons Halflings" style:normal
weight:normal stretch:normal src index:1): status 2147746065
source: http://mydomain.com/assets/bootstrap/glyphicons-halflings-regular.woff
確實沒有這樣的文件,但是具有資產管道摘要的同一文件。 所以在我看來,資產管道文件的請求被破壞,因此試圖獲取正常文件? 或者我的資產管道壞了嗎? 不太確定。 並不確定為什么它可以在我的本地機器上運行,但不能在服務器上運行。
我是否必須以不同方式配置我的production.rb?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
考慮到性能問題,將config.assets.compile
設置為true
並不是最佳解決方案。
您可能想嘗試RAILS_ENV=production bundle exec rake assets:precompile
和重啟服務器。
通過設置解決了它
config.assets.compile = true
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.