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

feat(embed): Implement template loading from embedded filesystem #48

Merged
merged 5 commits into from Mar 29, 2024

Conversation

bliepp
Copy link
Contributor

@bliepp bliepp commented Sep 28, 2022

This pull requests implements a function AddFromFS as requested by #30 for everything matching the interface fs.FS from the standard library (primarily embed.FS of course) to get rid of ugly workarounds.

This PR breaks compatibility with go version 1.15 and below as it relies on the fs.FS interface

@bambamboole
Copy link

Can I somehow support, that we get this merged?
My current project would benefit from this :)

@bliepp
Copy link
Contributor Author

bliepp commented Dec 29, 2022

Can I somehow support, that we get this merged?
My current project would benefit from this :)

This repo doesn't seem to have significant activities for the last 4 months so I guess it's just a matter of time until the maintainer(s) merge it. From a technical perspective it should be ready to merge.

If it's urgent I suggest you take a look at the workaround at #30 and refactor once this PR gets merged. Under the hood it's the same as implemented here with the non-dynamic renderer.

@matt9mg
Copy link

matt9mg commented Mar 8, 2023

+1 for this to be implemented

@mrpineapples
Copy link

Would love to get this merged in 🙏🏼

@@ -15,6 +16,7 @@ type Renderer interface {
Add(name string, tmpl *template.Template)
AddFromFiles(name string, files ...string) *template.Template
AddFromGlob(name, glob string) *template.Template
AddFromFS(name string, fsys fs.FS, files ...string) *template.Template

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to also have an AddFromFSFuncs if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been a while since I created this PR and the maintainers don't seem to care for a merge. So I'll wait for it to be merged before putting any more effort into this.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I see, that's a shame. But I used the workaround in #30, not the worst thing in the world 😭

@appleboy appleboy changed the title Implement template loading from embedded filesystem feat(embed): Implement template loading from embedded filesystem Mar 29, 2024
@appleboy appleboy merged commit ea49057 into gin-contrib:master Mar 29, 2024
9 checks passed
@appleboy
Copy link
Member

https://github.com/gin-contrib/multitemplate/releases/tag/v1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants