Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed
benblazak wants to merge1 commit intosveltejs:mainfrombenblazak:main

Conversation

@benblazak
Copy link

Fixes#459.

Allows for pug template inheritance.

The issue was thatextends statements 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 anextends statement occurs as the first line in a file, it is split off from the rest of the content and inserted before the svelte mixins.

  • test
  • lint

notes

I wasn't able to research or test whether there are other things that should also be kept before svelte mixins.

// separate content that needs to come before the svelte mixins
letpreContent='';

if(content.startsWith('extends')){
Copy link
Member

@kaisermannkaisermannMar 14, 2023
edited
Loading

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')

@kaisermann
Copy link
Member

Hey@benblazak, thanks for this! Just added a small suggestion 🙏

@benblazak
Copy link
Author

Ahh good catch@kaisermann. To properly allow comments though, we'd probably need to parse them (there can be more than one beforeextends right? and multi-line comments are allowed in that location too?), which is more than I'm up for right now (in the middle of a move -> new job).

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.

@simiraaaasimiraaaa mentioned this pull requestMay 11, 2023
1 task
@simiraaaa
Copy link
Contributor

@kaisermann@benblazak
#599

Fixed so that extends works with comments andprependData.
Please refer to it.

(Machine translation from Japanese to English at DeepL)

benblazak reacted with thumbs up emoji

@benblazakbenblazak closed this by deleting the head repositorySep 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@kaisermannkaisermannkaisermann left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

cannot use pug template inheritance

3 participants

@benblazak@kaisermann@simiraaaa

[8]ページ先頭

©2009-2025 Movatter.jp