gpt4 book ai didi

css - Rails 4 : SASS background image works locally, 在 AWS 中失败

转载 作者:太空宇宙 更新时间:2023-11-04 03:11:41 25 4
gpt4 key购买 nike

刚刚更新到 Rails 4,现在这种风格,在历史上适用于任何地方,现在只适用于本地:

#subfooter {
width: 1160px;
margin: 0 auto;
padding: 45px 0 20px;
background: url(ap@1x.png) no-repeat top left;
}

它在 AWS 中失败了。有人对跨环境的 SASS/CSS 加载图像差异有任何想法吗?

谢谢。

最佳答案

这是因为在生产环境中,您无法在编译时使用具有直接 URL 的 Assets 。因此,要解决您的问题,您必须改为这样做:

#subfooter {
width: 1160px;
margin: 0 auto;
padding: 45px 0 20px;
background: url(image_path("ap@1x.png")) no-repeat top left;
}

我希望这能回答您的问题。

关于css - Rails 4 : SASS background image works locally, 在 AWS 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29405401/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com