- Notifications
You must be signed in to change notification settings - Fork147
fix: allow pug template inheritance#572
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| // separate content that needs to come before the svelte mixins | ||
| letpreContent=''; | ||
| if(content.startsWith('extends')){ |
kaisermannMar 14, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Given theexample of inheritance from pug's documentation, what do you think of also adding support for files that start with a comment?
//- page-a.pugextendslayout.pugblockscripts script(src='/jquery.js') script(src='/pets.js')
Hey@benblazak, thanks for this! Just added a small suggestion 🙏 |
Ahh good catch@kaisermann. To properly allow comments though, we'd probably need to parse them (there can be more than one before Thinking about it, it might make more sense to stop including mixins by default at all, and put them in a separate file for people to include if they want. But that would be a breaking change. |
Fixed so that extends works with comments and (Machine translation from Japanese to English at DeepL) |
Fixes#459.
Allows for pug template inheritance.
The issue was that
extendsstatements must occur first in a pug file, but the svelte mixins were being inserted at the top of the file contents before being passed to pug.I made changes so that if an
extendsstatement occurs as the first line in a file, it is split off from the rest of the content and inserted before the svelte mixins.notes
I wasn't able to research or test whether there are other things that should also be kept before svelte mixins.