Skip to content

Commit 707206f

Browse files
author
Misha Zamkevich
authored
feat: add new syntax {key} for pug (#259)
1 parent 3405224 commit 707206f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

docs/preprocessing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ Apart from those, the Pug preprocessor accepts:
297297

298298
**Template blocks:**
299299

300-
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()`.
300+
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()`.
301301

302302
```pug
303303
ul

src/transformers/pug.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ mixin elseif(condition)
1818
%_| {:else if !{condition}}
1919
%_block
2020
21+
mixin key(expression)
22+
%_| {#key !{expression}}
23+
%_block
24+
%_| {/key}
25+
2126
mixin each(loop)
2227
%_| {#each !{loop}}
2328
%_block

0 commit comments

Comments
 (0)