我想顯示一個簡單的圖像從我的資產圖像。我試圖在下列方式:css沒有加載圖像資產在軌道上4
#head {
background: #181015 url(../images/header_bg.png) no-repeat;
background-size: cover;
min-height: 520px;
text-align: center;
padding-top: 240px;
color: white;
font-family: "Open sans", Helvetica, Arial;
font-weight: 300;
}
在我assets/images
文件夾我有其他的影像。如果我設置其他圖像,那麼它的工作正常。但是,如果我嘗試加載上面的圖像,那麼它無法加載該圖像。我把下面的事情我environments/development.rb
config.assets.debug = true
config.assets.compile = true
config.assets.precompile = ['*.js', '*.css', '*.css.erb']
我也跑bundle exec rake assets:precompile
後來也實在是無法加載圖像。該圖像沒有任何問題。因爲我嘗試使用相同的CSS的簡單的HTML頁面,它工作正常。我錯過了什麼。需要一些幫助。
http://stackoverflow.com/questions/16512080/how-can-i-reference- css-background-images-in-production-in-rails-4-0 –