Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi Speed peeps!
Do you know if there is a way to target viewports with liquid? I just downloaded the Shopify Chrome extension to see the impact of liquid in our store, and found out that the mobile menu and desktop menu both take almost 500ms to render/compile. So I'm trying to find a way to achieve that using liquid. Any ideas?
Impossible. Liquid is rendered server side.
Only javascript can be aware of a browsers screen size.
Actually thats not true, Shopify could check for user agents and use that to create an option to serve screen size conditional code, but they don't have that implemented right now, I doubt they will in the near future as it's impractical, problematically inconsistent, to do, and requires a fair amount of work.
Blah, I did know that, and I've been looking for similar things in the past and learned that it's only for server-side stuff.
However, I do have Cloudflare set up for our shop. And Cloudflare knows the user agents and so on. Perhaps it could be possible to do something with that? Perhaps I could set something up in Cloudflare, that will pass on to Shopify for it to render more effectively?
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025