diff options
Diffstat (limited to 'modules/templates/static.go')
-rw-r--r-- | modules/templates/static.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/templates/static.go b/modules/templates/static.go index e69e1cae48..3aabe17e4f 100644 --- a/modules/templates/static.go +++ b/modules/templates/static.go @@ -203,3 +203,21 @@ func Mailer() *template.Template { return templates } + +func Asset(name string) ([]byte, error) { + f, err := Assets.Open("/" + name) + if err != nil { + return nil, err + } + defer f.Close() + return ioutil.ReadAll(f) +} + +func AssetNames() []string { + realFS := Assets.(vfsgen۰FS) + var results = make([]string, 0, len(realFS)) + for k := range realFS { + results = append(results, k[1:]) + } + return results +} |