New Shopify Certification now available: Liquid Storefronts for Theme Developers

preload_tag missing support for crossorigin tag

2 0 0

I have the following code, which theme-check is flagging as "For better performance, prefer using the preload_tag filter":


<link rel="preload" as="font" href="{{ header_font | font_url }}" type="font/woff2" crossorigin>

I tried using this liquid:

{{ header_font | font_url | preload_tag: as: 'font' }}

which generates this code:

<link href="not a real url" rel="preload" as="font" rel="preload">

But as its missing the crossorigin tag, this code isn't used due to CORS

I suspect the preload_tag function needs to be augmented to be able to add crossorigin. 

Is there another solution? Thanks


Reply 1 (1)