feat: add tailwindcss

This commit is contained in:
Guz
2025-03-06 10:02:35 -03:00
parent c2bddbf32c
commit 242559acc9
7 changed files with 1116 additions and 4 deletions

View File

@@ -29,6 +29,9 @@
gotools
delve
# TailwindCSS
tailwindcss
# Sqlite tools
sqlite
lazysql

View File

@@ -7,7 +7,7 @@ fmt:
go fmt .
golangci-lint run --fix .
dev:
dev/server:
go run github.com/joho/godotenv/cmd/godotenv@v1.5.1 \
go run github.com/air-verse/air@v1.52.2 \
--build.cmd "go build -o .tmp/bin/main ." \
@@ -21,8 +21,15 @@ dev:
--misc.clean_on_exit true \
-- -dev -port $$(($(PORT) + 1))
dev/assets:
tailwindcss -o ./static/css/wind.css -w
dev:
$(MAKE) -j2 dev/server dev/assets
build:
go generate
go build -o ./.dist/app .
run: build

View File

@@ -30,11 +30,12 @@ func New(assertions tinyssert.Assertions, log *slog.Logger, dev bool) http.Handl
r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
err := templates.Templates().ExecuteTemplate(w, "test.html", nil)
err := templates.Templates().ExecuteTemplate(w, "index.html", nil)
if err != nil {
exception.InternalServerError(err).ServeHTTP(w, r)
}
})
r.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static"))))
r.HandleFunc("/test", func(w http.ResponseWriter, r *http.Request) {
exception.InternalServerError(errors.New("TEST ERROR"),
exception.WithData("test-data", "test-value"),

0
static/css/.gitkeep Normal file
View File

24
static/static.go Normal file
View File

@@ -0,0 +1,24 @@
package static
import (
"embed"
"io/fs"
)
//go:generate tailwindcss -o static/css/wind.css
//go:embed css/*.css
var staticFiles embed.FS
func Files(local ...bool) fs.FS {
var l bool
if len(local) > 0 {
l = local[0]
}
if !l {
return staticFiles
}
return staticFiles
}

1077
tailwind.config.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,10 +2,10 @@
<html>
<head>
<link rel="stylesheet" href="/static/css/wind.css">
</head>
<body>
<body class="text-red-600">
<h1>Hello, world</h1>
</body>