diff --git a/docs/preprocessing.md b/docs/preprocessing.md index 28aa83b..80ee25e 100644 --- a/docs/preprocessing.md +++ b/docs/preprocessing.md @@ -291,7 +291,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()`, `+key()`, `+await()`, `+then()`, `+catch()`, `+html()`, `+const()`, `+debug()`. +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()`. ```pug ul diff --git a/src/transformers/pug.ts b/src/transformers/pug.ts index dfad060..085922f 100644 --- a/src/transformers/pug.ts +++ b/src/transformers/pug.ts @@ -47,7 +47,15 @@ mixin const(expression) %_| {@const !{expression}} mixin debug(variables) -%_| {@debug !{variables}}`.replace( +%_| {@debug !{variables}} + +mixin snippet(expression) +%_| {#snippet !{expression}} +%_block +%_| {/snippet} + +mixin render(expression) +%_| {@render !{expression}}`.replace( /%_/g, indentationType === 'tab' ? '\t' : ' ', );