当前位置: 首页 > 工具软件 > Shopify-Dawn > 使用案例 >

Shopify Font 的用法

郤令
2023-12-01

Shopify Font 的用法

示例代码1

{%- comment -%}Style 字体{%- endcomment -%}
{%- liquid
  style
    assign var_fonts = 'body-font,header-font' | split: ','
    assign font_handles = 'type_body_font,type_header_font' | split: ','
    assign weights = '100,200,300,400,500,600,700,900' | split: ','
    for font_handle in font_handles
      assign font = settings[font_handle]
      for weight in weights
        echo font | font_modify: 'weight', weight | font_face: s: 'swap'
      endfor
      echo ":root {--" | append: var_fonts[forloop.index0] | append: ":" | append: font.family | append: ';}'
    endfor
  endstyle
-%}
 类似资料: