我正在使用Heroku - Yeoman - AngularJS全栈- Bootstrap - NodeJS栈。
Heroku上的部署是使用“Grunt build”命令构建的。当部署到Heroku时,我在网页上渲染CSS图像时遇到了问题。将显示页面中的任何图像,但不显示CSS文件中的图像。
下面的代码不起作用
CSS
.aboutpage-header
{
height: 250px;
background: url('../images/slider-map.jpg') center center no-repeat scroll;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
padding-top: 50px;
}HTML:
<header class="aboutpage-header">
<div class="container text-center">
<div class="row">
<div class="col-lg-12">
<h2 class="title">About Us</h2>
<h2 class="intro"><i class="fa fa-location-arrow"></i>Company<span class="highlight">IT</span>
are experts in bespoke software development and tailored consulting</h2>
</div>
</div>
</div>
</header>在本地,它在运行Grunt serve时运行得很好,但一旦部署到Heroku上,CSS图像就会丢失。
发布于 2015-09-03 02:19:05
正如评论中所建议的,链接应该是:
/assets/images/image.jpg而不是:
../assets/images/image.jpghttps://stackoverflow.com/questions/29863981
复制相似问题