sveltejs / svelte-preprocess

A ✨ magical ✨ Svelte preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more.
MIT License
1.73k stars 147 forks source link

What's the syntax for a keyed each block in pug for this pre-processor? #574

Open geoidesic opened 1 year ago

geoidesic commented 1 year ago
Screenshot 2023-02-11 at 18 12 46

The example shown in the docs:

<template lang="pug">
  div Posts +each('posts as post') a(href="{post.url}") {post.title}
</template>

What I'm trying to do:

{#each [...$wildcard] as item (item.id)}
                  <li animate:flip={{ duration: 200 }}>{item.name}</li>
 {/each}

So it's the item (item.id) bit which I can't figure out how to represent using svelte-preprocessor's syntax.

If this feature doesn't exist, please add it! If it does, please document it here: https://github.com/sveltejs/svelte-preprocess/blob/main/docs/preprocessing.md#pug