[英]Sling Rewriter to change the static resource URL
我们在我们的项目中使用了 sling rewriter 来使用我们的 OSGI 配置中定义的静态域来转换资源 URL。 这对于组件中的 include tags 属性中定义的标签工作正常。 例如,对于样式标签,当属性是数据角色时。 它按预期转换 url-
但是对于以下情况,需要转换 background:url 的 url。 而不是从本地主机中选择它应该将其转换为 OSGI 配置中提到的静态 url-
<style>
@media screen and (min-width: 1200px) {
.lazy-bg--4021ca1508b28f815a670f961c7fcba6 {
background:url(http://localhost:4512/content/dam/unilever/magnum/spain/static_not_in-use_products_/magnum_vegan_key_visual_green_classic_2880x1200_72dpi-1395468-jpg.jpg.ulenscale.1500x649.jpg) no-repeat;
background-size: cover
}
}
由于 background:url 在这里不是 style 标签的属性,所以 url 没有被转换。 你能提供一些意见吗?
由于重写器仅处理一组配置的属性,因此您需要手动映射此资源路径(使用资源解析器 api)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.