html - 将图像作为 sass 变量添加到 html-twig 文件
问题描述
这是一个问题,部分与之前的讨论有关:Sass 中的图像路径中有变量吗?
我正在尝试通过 Symfony 项目的树枝文件(与 HTML 非常相似)上的一个标签传递徽标图像并将特定样式应用于此徽标。
我用背景图像修复了它,它实际上可以工作,但徽标仍然没有出现在任何地方......你能帮我吗?
尽管背景图像实际上正在工作,但它给了我一个警告......
`/* variables.scss file */
$footer-icon : url('image/'+ $customer +'/icon/footer-icon.svg');
$background-image : url('image/'+ $customer +'/'+'background.jpg');
/*****************/
/*_frontend-utils.scss*/
.beforeBackgroundImage {
overflow-x: hidden;
}
.backgroundImage {
background-image: $background-image;
}
.afterBackgroundImage {
background-position-y: bottom;
background-position-x: center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-repeat: no-repeat;
height: 100%;
}
/*****************/
/* frontend.html.twig */
<div id="wrap" class="beforeBackgroundImage backgroundImage afterBackgroundImage">
/*it works! =)*/
/*****************/
/*_footer.scss*/
.footerSecond {
display: block;
bottom: 0;
position: absolute;
height: 50px;
text-align: center;
width: 100%;
left: 0
}
.beforeFooterImage {
margin: 0px;
height: 48px;
}
/*I also tried with background-image...*/
.footerImage {
image: $footer-icon;
}
/*****************/
/*footer.html.twig*/
<div class="pull-left"class="opacityOne beforeFooterImage footerImage">
`
我可以通过直接在标签内写入图像路径来修复它,但我想将其与代码分开
<div class="pull-left"class="opacityOne">
<img class="beforeFooterImage" src="{{asset('bundles/app/img/footer-icon.svg')}}" alt="" />
提前致谢
解决方案
推荐阅读
- python - 将新数据附加到 JSON
- scala - JMSConnection 序列化失败
- javascript - 如何使用 jest 测试包含数组的对象
- servicenow - 此评估意外失败,提供的类型无效
- apache - 将流量重定向到前端和后端的代理
- post - 启动内核时出错:POST 中缺少“_xsrf”参数
- javascript - 是否可以将 Scala 编译(转译)到浏览器,同时保持解释用户动态提供的 Scala 代码的能力?
- vb.net - 显示文件夹中的所有excel文件
- php - 如何在 laravel API 中验证他的令牌时将用户的 IP 与他的访问令牌一起存储,然后将其与他当前的 IP 进行比较?
- arrays - 检查列表的大小是线性的吗?