{% doc %} Delays Shopify header scripts until the first interaction. Scripts tagged nolazy, plus JSON and JSON-LD blocks, stay immediate. @param {string} html - Markup captured from content_for_header @example {% capture shopify_header %}{{ content_for_header }}{% endcapture %} {% render 'delay-header-scripts', html: shopify_header %} {% enddoc %} {% capture blocking_style %}rel="stylesheet" media="screen"{% endcapture %} {% capture deferred_style %}rel="stylesheet" media="print" onload="this.media='all'"{% endcapture %} {% liquid if request.design_mode or html == blank echo html else assign blocking_style = blocking_style | strip assign deferred_style = deferred_style | strip assign html = html | replace: 'media="screen"', 'media="print" onload="this.media='all'"' assign chunks = html | split: '' | first if open_tag contains 'application/json' or open_tag contains 'application/ld+json' or open_tag contains 'nolazy' or chunk contains 'portable-wallets' or chunk contains 'shopify.dynamic_checkout' echo '