【发布时间】:2015-08-09 07:46:14
【问题描述】:
我正在尝试从我的资产图像中显示一张简单的图像。我尝试以下方式:
#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 页面,它工作正常。我有什么遗漏吗。需要一些帮助。
【问题讨论】:
标签: html css ruby-on-rails image assets