{% removeemptylines %} {% assign svg-file="svg/" | append: include.icon | append: ".svg" %} {% capture svg-icon %} {% include {{ svg-file }} %} {% endcapture %} {% assign replace-to = "icon" %} {% if include.right %} {% assign replace-to = replace-to | append: " icon-right" %} {% endif %} {% if include.class %} {% assign replace-to = replace-to | append: ' ' | append: include.class %} {% endif %} {% if include.color %} {% assign replace-to = replace-to | append: ' text-' | append: include.color %} {% endif %} {% assign replace-to = 'class="' | append: replace-to | append: '"' %} {{ svg-icon | replace_regex: 'class=\"[^"]+\"', replace-to }} {% endremoveemptylines %}