-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Hello, and sorry for the potentially confusing title.
I am using Vento via eleventy-plugin-vento for Eleventy, but have managed to replicate the issue in the Vento playground. If a value already exists (in my case, from a template file or a global data value), if I try to overwrite it conditionally, without an else clause, the value is voided/null/empty if the condition is falsy.
{{> url = 'abc' }}
{{ if path }}{{ set url = path }}{{ /if }}
My url value is: {{ url }}
With the example above, if my global data has a url variable (simulated with the first line of JS), but no path variable, the if block should be skipped. However, this produces an empty value. If I remove the if line, the url value is printed as expected.
I don't know exactly how data is fed in the plugin but given I get the same behaviour with just these three lines with Vento in the playground, I would imagine the same underlying issue occurs.
Similarly, if I run the following code with the same conditions (url truthy, path falsy), the variable returns null:
{{ set url = url || path || null }}
I am working around it for now by declaring new variables, but would love for the standard JavaScript reassignment feature to work the same in Vento.
Please let me know if you need more info or examples, I'd be happy to provide them.
Thanks!