nezha/resource/resource.go

32 lines
474 B
Go
Raw Normal View History

2023-11-28 10:01:37 -05:00
package resource
import (
"embed"
"github.com/naiba/nezha/pkg/utils"
2023-11-28 10:01:37 -05:00
)
var StaticFS *utils.HybridFS
2023-11-28 10:01:37 -05:00
//go:embed static
var staticFS embed.FS
2023-11-28 10:01:37 -05:00
//go:embed template
var TemplateFS embed.FS
//go:embed l10n
var I18nFS embed.FS
func init() {
var err error
StaticFS, err = utils.NewHybridFS(staticFS, "static", "resource/static/custom")
if err != nil {
panic(err)
}
}
2023-11-28 10:01:37 -05:00
func IsTemplateFileExist(name string) bool {
_, err := TemplateFS.Open(name)
return err == nil
}