ventojs / vento

🌬 A template engine for Deno & Node
https://vento.js.org/
MIT License
212 stars 12 forks source link

for not working as expected with AsyncIterable? #28

Closed stereosteve closed 10 months ago

stereosteve commented 10 months ago

Had a dir.vto file in a lume 2 application like this:

{{Array.from(Deno.readDirSync(".")).map(f => f.name).join(",")}}

{{ for file of Array.from(Deno.readDirSync(".")) }}
<div> 1: {{file.name}}</div>
{{ /for }}

{{ for file of Deno.readDirSync(".") }}
<div> 2: {{file.name}}</div>
{{ /for }}

{{ for await file of Deno.readDir(".") }}
<div> 3: {{file.name}}</div>
{{ /for }}

Only the 1 prefix version shows up... 2 and 3 both missing.

Based on the docs I would have thought 2 and 3 would work...

oscarotero commented 10 months ago

Hi! Thanks for bringing this up. I just released the version 0.10.2 with support for iterables. Feel free to reopen the issue if you find any issue.

stereosteve commented 10 months ago

Funny. I took a stab at it here.

Pretty similar, altho I don't think mine would work with the key, value style.

Thanks for the quick fix!