微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

css – 背景图像没有显示在heroku

我在我的heroku网站的背景图像有问题,在本地使用
background-image: url('background_stripe.png');

工作,但部署时文件已损坏

我试过使用

background-image: image-url('background_stripe.png');
background-image: url(image-url('background_stripe.png'));
background-image: url(image_url('background_stripe.png'));

没有一个在当地或英雄上工作.

使用bash我发现英雄已经命名了图像文件background_stripe.png,但它没有哈希和它的破碎的图像

解决方法

在你的production.rb中添加以下行
config.serve_static_assets = true
config.assets.compile = true

或者您可以尝试使用本地预编译资产

RAILS_ENV=production rake assets:precompile

原文地址:https://www.jb51.cc/css/217395.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。