From 0551a9b557ee18bb05a3e9021a8c9aa1f7b8c665 Mon Sep 17 00:00:00 2001 From: Nikita Fedorov <50797337+fedorovvvv@users.noreply.github.com> Date: Sat, 4 Jun 2022 20:55:06 +0300 Subject: [PATCH] fix: add pug const mixin (#518) Closes #467 --- docs/preprocessing.md | 2 +- src/transformers/pug.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/preprocessing.md b/docs/preprocessing.md index 1f4d61cc..10b0b194 100644 --- a/docs/preprocessing.md +++ b/docs/preprocessing.md @@ -290,7 +290,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()`, `+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()`, `+const()`, `+debug()`. ```pug ul diff --git a/src/transformers/pug.ts b/src/transformers/pug.ts index b1c8494c..1d851bf7 100644 --- a/src/transformers/pug.ts +++ b/src/transformers/pug.ts @@ -44,6 +44,9 @@ mixin catch(error) mixin html(expression) %_| {@html !{expression}} +mixin const(expression) +%_| {@const !{expression}} + mixin debug(variables) %_| {@debug !{variables}}`.replace( /%_/g,