feat: add tailwindcss
This commit is contained in:
@@ -29,6 +29,9 @@
|
||||
gotools
|
||||
delve
|
||||
|
||||
# TailwindCSS
|
||||
tailwindcss
|
||||
|
||||
# Sqlite tools
|
||||
sqlite
|
||||
lazysql
|
||||
|
||||
9
makefile
9
makefile
@@ -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
|
||||
|
||||
@@ -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
0
static/css/.gitkeep
Normal file
24
static/static.go
Normal file
24
static/static.go
Normal 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
1077
tailwind.config.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user