Include SVGs inline in themes
5
If you would like to include inline SVGs in your theme templates then you can do the following:
- Create a partial called
include-svg.htm
and put the following code in it:
==
<?php
function onStart() {
$this['svgContents'] = File::get(base_path($this->file));
}
?>
==
{{ svgContents|raw }}
- Include your desired SVG like so:
{% partial "include-svg" file="themes/mytheme/assets/images/mysvg.svg" %}
There are no comments yet
Be the first one to comment