icon.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. {% assign icon-name = include.icon %}
  2. {% assign replace-to = "icon" %}
  3. {% if include.class %}
  4. {% assign replace-to = replace-to | append: ' ' | append: include.class %}
  5. {% endif %}
  6. {% if include.color %}
  7. {% assign replace-to = replace-to | append: ' text-' | append: include.color %}
  8. {% endif %}
  9. {% if include.filled %}
  10. {% assign replace-to = replace-to | append: ' icon-filled' %}
  11. {% endif %}
  12. {% if include.inline %}
  13. {% assign replace-to = replace-to | append: ' icon-inline' %}
  14. {% endif %}
  15. {% if size %}
  16. {% assign replace-to = replace-to | append: ' icon-' | append: size %}
  17. {% endif %}
  18. {% assign size = size | default: 24 %}
  19. {% assign replace-to = 'class="' | append: replace-to | append: '"' %}
  20. {% if site.use-iconfont %}
  21. <i class="icon ti ti-{{ icon-name }}{% if include.color %} {{ include.color }}{% endif %}{% if include.filled %} icon-filled{% endif %}{% if include.class %} {{ include.class }}{% endif %}"></i>
  22. {% else %}
  23. <!-- Download SVG icon from http://tabler-icons.io/i/{{ icon-name }} -->
  24. {% assign svg-icon = icons[icon-name].svg | default: '' %}
  25. {{ svg-icon | replace_regex: 'class=\"[^"]+\"', replace-to }}
  26. {% endif %}