mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2026-01-27 17:11:13 +00:00
fix embed handling
This commit is contained in:
2
main.go
2
main.go
@@ -37,7 +37,7 @@ func main() {
|
||||
render.Initialize(views)
|
||||
|
||||
app := http.NewServeMux()
|
||||
app.Handle("/static/", http.FileServerFS(static))
|
||||
app.Handle("/static/", http.StripPrefix("/static/", http.FileServerFS(static)))
|
||||
app.Handle("GET /test-render", wrapHandler(func(w http.ResponseWriter, r *http.Request) error {
|
||||
err := render.Render(w, "errors/404", nil)
|
||||
fmt.Println(err)
|
||||
|
||||
@@ -28,11 +28,10 @@ func Initialize(views fs.FS) {
|
||||
r := new(renderer)
|
||||
r.templates = make(map[string]*raymond.Template)
|
||||
r.registerHelpers()
|
||||
fs.WalkDir(views, "/", func(path string, d fs.DirEntry, err error) error {
|
||||
fs.WalkDir(views, ".", func(path string, d fs.DirEntry, err error) error {
|
||||
if err != nil || d.IsDir() {
|
||||
return err
|
||||
}
|
||||
path, _ = filepath.Rel("/", path)
|
||||
name, hasExt := strings.CutSuffix(path, ext)
|
||||
if !hasExt {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user