big tings
This commit is contained in:
25
registry/templates.go
Normal file
25
registry/templates.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Package registry provides functionality for managing and accessing embedded file systems and directories.
|
||||
package registry
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io"
|
||||
)
|
||||
|
||||
//go:embed templates/*.marka
|
||||
var templates embed.FS
|
||||
|
||||
func GetTemplate(name string) (string, error) {
|
||||
templateFile, err := templates.Open("templates/" + name + ".marka")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer templateFile.Close()
|
||||
|
||||
templateBytes, err := io.ReadAll(templateFile)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(templateBytes), nil
|
||||
}
|
Reference in New Issue
Block a user