ai cooking
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #131 from paulgmiller/pmiller/embed

just embed css

authored by

Paul Miller and committed by
GitHub
cca332cd 03848ddc

+9 -3
-1
Dockerfile
··· 14 14 FROM gcr.io/distroless/static:nonroot 15 15 WORKDIR /workspace 16 16 COPY --from=builder /src/careme /careme 17 - COPY --from=builder /src/static/tailwind.css /static/tailwind.css 18 17 # Copy CA certs (distroless already has them, included for clarity) 19 18 # COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ 20 19 EXPOSE 8080
+8 -1
cmd/careme/web.go
··· 28 28 //go:embed favicon.png 29 29 var favicon []byte 30 30 31 + //go:embed static/tailwind.css 32 + var tailwindCSS []byte 33 + 31 34 const sessionDuration = 365 * 24 * time.Hour 32 35 33 36 func init() { ··· 47 50 return fmt.Errorf("failed to create recipe generator: %w", err) 48 51 } 49 52 mux := http.NewServeMux() 50 - mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static")))) 53 + mux.HandleFunc("/static/tailwind.css", func(w http.ResponseWriter, r *http.Request) { 54 + w.Header().Set("Content-Type", "text/css; charset=utf-8") 55 + w.Header().Set("Cache-Control", "public, max-age=31536000, immutable") 56 + w.Write(tailwindCSS) 57 + }) 51 58 52 59 locationserver, err := locations.New(context.TODO(), cfg) 53 60 if err != nil {
static/tailwind.css cmd/careme/static/tailwind.css
+1 -1
tailwind/generate.sh
··· 1 1 # Use npx with explicit packages so CSS @import "tailwindcss" resolves in CI. 2 2 npm --prefix tailwind install --no-audit --no-fund 3 - npx --prefix tailwind tailwindcss -i ./tailwind/input.css -o ./static/tailwind.css --minify 3 + npx --prefix tailwind tailwindcss -i ./tailwind/input.css -o ./cmd/careme/static/tailwind.css --minify