diff --git a/docs/preprocessing.md b/docs/preprocessing.md index 26597288..a9f36854 100644 --- a/docs/preprocessing.md +++ b/docs/preprocessing.md @@ -297,7 +297,7 @@ Apart from those, the Pug preprocessor accepts: **Template blocks:** -Some of Svelte's template syntax is invalid in Pug. `svelte-preprocess` provides some pug mixins to represent svelte's `{#...}{/...}` blocks: `+if()`, `+else()`, `+elseif()`, `+each()`, `+await()`, `+then()`, `+catch()`, `+html()`, `+debug()`. +Some of Svelte's template syntax is invalid in Pug. `svelte-preprocess` provides some pug mixins to represent svelte's `{#...}{/...}` blocks: `+if()`, `+else()`, `+elseif()`, `+each()`, `+key()`, `+await()`, `+then()`, `+catch()`, `+html()`, `+debug()`. ```pug ul diff --git a/src/transformers/pug.ts b/src/transformers/pug.ts index 3303efce..7f4ad1af 100644 --- a/src/transformers/pug.ts +++ b/src/transformers/pug.ts @@ -18,6 +18,11 @@ mixin elseif(condition) %_| {:else if !{condition}} %_block +mixin key(expression) +%_| {#key !{expression}} +%_block +%_| {/key} + mixin each(loop) %_| {#each !{loop}} %_block