Skip to content

Commit 9d49f3d

Browse files
authoredSep 9, 2024··
fix: add pug mixins to support svelte-5 syntax (#654)
* support for svelte-5 #snippet and @render * Update preprocessing.md
1 parent 359b1f6 commit 9d49f3d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed
 

‎docs/preprocessing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ Apart from those, the Pug preprocessor accepts:
291291

292292
**Template blocks:**
293293

294-
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()`, `+const()`, `+debug()`.
294+
Some of Svelte's template syntax is invalid in Pug. `svelte-preprocess` provides some pug mixins to represent svelte's `{#...}{/...}` and `{@...}` blocks: `+if()`, `+else()`, `+elseif()`, `+each()`, `+key()`, `+await()`, `+then()`, `+catch()`, `+html()`, `+const()`, `+debug()`, `+snippet()`, `+render()`.
295295

296296
```pug
297297
ul

‎src/transformers/pug.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,15 @@ mixin const(expression)
4747
%_| {@const !{expression}}
4848
4949
mixin debug(variables)
50-
%_| {@debug !{variables}}`.replace(
50+
%_| {@debug !{variables}}
51+
52+
mixin snippet(expression)
53+
%_| {#snippet !{expression}}
54+
%_block
55+
%_| {/snippet}
56+
57+
mixin render(expression)
58+
%_| {@render !{expression}}`.replace(
5159
/%_/g,
5260
indentationType === 'tab' ? '\t' : ' ',
5361
);

0 commit comments

Comments
 (0)
Please sign in to comment.