svelte-preprocess icon indicating copy to clipboard operation
svelte-preprocess copied to clipboard

cannot use pug template inheritance

Open benblazak opened this issue 2 years ago • 2 comments

bug

cannot use pug template inheritance

test

sample repo: https://github.com/benblazak/_svelte_preprocess__pug_template_inheritance

git clone https://github.com/benblazak/_svelte_preprocess__pug_template_inheritance.git
cd _svelte_preprocess__pug_template_inheritance
npm install
npm run dev -- --open
  • try the mixin link
    • this should work
  • try the template link
    • this should fail with the error message

      Declaration of template inheritance ("extends") should be the first thing in the file. There can only be one extends statement per file.

ideas

i think the reason extends ... is not the first thing in the file is because the svelte mixins are prepended here: https://github.com/sveltejs/svelte-preprocess/blob/a239e829295bde5f62383697266cefe7767dd0e2/src/transformers/pug.ts#L68

benblazak avatar Jan 10 '22 23:01 benblazak

@benblazak Have you found a solution to this issue? This is the exact issue i'm running into

Minasokoni avatar Feb 03 '23 19:02 Minasokoni

@Minasokoni I needed the practice, so i submitted a pull request. Till then you can use the branch -- or feel free to improve it (no matter who get's the PR credit, if they're willing to accept a fix) I may not have time to do more than this first submission.

benblazak avatar Feb 04 '23 02:02 benblazak