feat(web): set up templ layout with tailwindcss 4.3 and axios
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
0af74267b9
commit
8ea459e5f1
10 files changed
+1702
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
//go:embed all:static
|
||||
var static embed.FS
|
||||
|
||||
func Static() http.FileSystem {
|
||||
sub, err := fs.Sub(static, "static")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return http.FS(sub)
|
||||
}
|
||||
|
||||
func Render(c *gin.Context, status int, comp templ.Component) {
|
||||
c.Status(status)
|
||||
c.Header("Content-Type", "text/html; charset=utf-8")
|
||||
if err := comp.Render(c.Request.Context(), c.Writer); err != nil {
|
||||
_ = c.Error(err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user