树枝:包含SVG文件中的外部代码 [英] Twig: Include external Code from an SVG file

查看:99
本文介绍了树枝:包含SVG文件中的外部代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将svg文件中的代码直接导入到树枝模板文件中?

Is it possible to inlcude code from a svg file directly into a twig template file?

类似的东西:

{% include 'my.svg' %}

这将导致:

<svg viewbox=".... />

推荐答案

一种方法:

{{ source('my.svg') }}

在此处了解更多信息: https://www.theodo.fr/blog/2017/01/integrating-and-interacting-with-svg-image-files-using-twig/

Read more here: https://www.theodo.fr/blog/2017/01/integrating-and-interacting-with-svg-image-files-using-twig/

这篇关于树枝:包含SVG文件中的外部代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆