diff --git a/cmd/template/advanced/files/htmx/imports/fiber.tmpl b/cmd/template/advanced/files/htmx/imports/fiber.tmpl index d3ab60c0..82dc3179 100644 --- a/cmd/template/advanced/files/htmx/imports/fiber.tmpl +++ b/cmd/template/advanced/files/htmx/imports/fiber.tmpl @@ -1,3 +1,5 @@ "github.com/a-h/templ" "{{.ProjectName}}/cmd/web" -"github.com/gofiber/fiber/v2/middleware/adaptor" \ No newline at end of file +"github.com/gofiber/fiber/v2/middleware/adaptor" +"github.com/gofiber/fiber/v2/middleware/filesystem" +"net/http" \ No newline at end of file diff --git a/cmd/template/advanced/files/htmx/routes/fiber.tmpl b/cmd/template/advanced/files/htmx/routes/fiber.tmpl index 1b78ea9e..fa0d44ea 100644 --- a/cmd/template/advanced/files/htmx/routes/fiber.tmpl +++ b/cmd/template/advanced/files/htmx/routes/fiber.tmpl @@ -1,4 +1,8 @@ -s.App.Static("/assets", "./cmd/web/assets") +s.App.Use("/assets", filesystem.New(filesystem.Config{ + Root: http.FS(web.Files), + PathPrefix: "assets", + Browse: false, + })) s.App.Get("/web", adaptor.HTTPHandler(templ.Handler(web.HelloForm())))