Skip to content

Commit 9d49f3d

Browse files
authored
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 9 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy