Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pug mixins to support svelte-5 #snippet and @render #654

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/preprocessing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion src/transformers/pug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' : ' ',
);
Expand Down
Loading