Closed dominik-lekse closed 3 years ago
Render templates from an embedded filesystem provides as an embed.FS.
embed.FS
render
EmbedFileSystem
render.FileSystem
1.16
// ... //go:embed templates/*.html templates/*.tmpl var embeddedTemplates embed.FS // ... r := render.New(render.Options{ Directory: "templates", FileSystem: &EmbedFileSystem{ FS: embeddedTemplates, }, Extensions: []string{".html", ".tmpl"}, }) // ...
Render templates from an embedded filesystem provides as an
embed.FS
.Description
render
should be able to use templates fromembed.FS
out of the box.Proposed changes
EmbedFileSystem
which implementsrender.FileSystem
and acts as an adapter toembed.FS
1.16
render
Example usage
References