You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I like inline snippets and I like the simplicity of {% snippet %} sharing the same namespace as {% assign %} and {% capture %} - you get snippet scoping for free.
However, while testing the implementation of {% snippet %} and the changes to {% render %}, I noticed some things that weren't immediately obvious to me:
We can pass an inline snippet to another snippet as an argument.
We can overwrite an inline snippet with non-snippet data.
Snippet blocks are bound to their names when they are rendered, not when they are parsed. (edit: Having given this some more thought, this is inconsequential. Somewhere in my subconscious I must have been thinking that we might want to disallow {% snippet %} inside control flow blocks and {% for %}, but continue to allow nested inline snippets.)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I like inline snippets and I like the simplicity of
{% snippet %}sharing the same namespace as{% assign %}and{% capture %}- you get snippet scoping for free.However, while testing the implementation of
{% snippet %}and the changes to{% render %}, I noticed some things that weren't immediately obvious to me:{% snippet %}inside control flow blocks and{% for %}, but continue to allow nested inline snippets.)Here's an example that made me pause:
Output
I'm curious what others think. Are these nice/intentional features, things to be avoided or things that we should prevent?
Beta Was this translation helpful? Give feedback.
All reactions