Is there a way to not certain render liquid on mobile?

Highlighted
Shopify Partner
33 0 9

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? 

0 Likes
Highlighted
Shopify Partner
72 8 46

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.

Available for freelance. I specialize in speed improvement and theme development.
https://www.upwork.com/fl/orionholmes
1 Like
Highlighted
Shopify Partner
33 0 9

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?

0 Likes