<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>PageSpeed on OKCKnet</title><link>/categories/pagespeed/</link><description>Recent content in PageSpeed on OKCKnet</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 27 Apr 2026 01:24:31 +0300</lastBuildDate><atom:link href="/categories/pagespeed/index.xml" rel="self" type="application/rss+xml"/><item><title>Shopify: Liquid Snippet for Loading CSS Asynchronously</title><link>/blog/work/shopify-liquid-snippet-for-loading-css-asynchronously/</link><pubDate>Wed, 18 Oct 2023 22:30:00 +0300</pubDate><guid>/blog/work/shopify-liquid-snippet-for-loading-css-asynchronously/</guid><description>&lt;p&gt;Shopify recently added section.index to the Liquid API. This is a great addition that allows you to do things like selectively load CSS based on the section index. This is useful for things like loading CSS asynchronously, which can help improve your page speed scores.&lt;/p&gt;
&lt;p&gt;If you want to load CSS asynchronously on Shopify, you can use this Liquid snippet:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;css.liquid&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-liquid"&gt; {%- liquid
 assign css = css | default: false
 assign section_index = section_index | default: 3
 -%}

 {%- if section_index &amp;gt; 2 -%}
 &amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;{{- css | asset_url-}}&amp;quot; media=&amp;quot;print&amp;quot; onload=&amp;quot;this.media='all'&amp;quot;&amp;gt;
 &amp;lt;noscript&amp;gt;
 {{- css | asset_url | stylesheet_tag -}}
 &amp;lt;/noscript&amp;gt;
 {%- else -%}
 {{- css | asset_url | stylesheet_tag -}}
 {%- endif -%}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, you can render this snippet in your theme with this code:&lt;/p&gt;</description></item></channel></rss>