question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does the render tag support with/as and for/as?

See original GitHub issue

Reviewing documentation for the render tag, it appears to have a few parameters that are not supported by LiquidJS.

The with parameter

A single object can be passed to a snippet by using the with and as parameters:

{% assign featured_product = all_products['product_handle'] %}
{% render 'product' with featured_product as product %}

In the example above, the product variable in the snippet will hold the value of featured_product in the parent template.

In my testing, it appears that while LiquidJS supports with, it does not support reassignment using as.

The for parameter

A snippet can be rendered once for each value of an enumerable object by using the for and as parameters:

{% assign variants = product.variants %}
{% render 'variant' for variants as variant %}

In the example above, the snippet will be rendered once for each variant of the product, and the variant variable will hold a product variant object within the snippet.

When using the for parameter, the forloop object is accessible within the snippet.

In my testing, it appears that LiquidJS does not support the for and as parameters.

Looking at the code for render in shopify/liquid, it appears these are core Liquid features (i.e., they are not Shopify specific), but I could be wrong.

What is the status of these parameters?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
harttlecommented, Mar 3, 2020

🎉 This issue has been resolved in version 9.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

0reactions
paulrobertlloydcommented, Mar 3, 2020

Awesome, thanks @harttle – can’t wait to try this out! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

ShaderLab: assigning tags to a SubShader - Unity - Manual
The Queue tag tells Unity which render queue to use for geometry that it renders. The render queue is one of the factors...
Read more >
HTML 5.1: 10. Rendering - W3C
User agents that do not support correct ruby rendering are expected to render parentheses around the text of rt elements in the absence...
Read more >
How can I render a <template /> tag with react? - Stack Overflow
I think I gave up, but the most promising path was Range.createContextualFragment() which does let the scripts run. Probably used with a Reactjs ......
Read more >
[Idea] Allowing slot for render #1530 - Shopify/liquid - GitHub
I know we can actually capture and pass variables, but this force to create a lot of capture and make the code way...
Read more >
Render - LiquidJS
Variables defined in parent's scope can be passed to a the partial template by listing them as parameters on the render tag:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found