Vendor Tailwind via the standalone CLI; drop the Play CDN
Tailwind is now compiled from static/css/input.css into a committed static/css/tailwind.css by the standalone CLI, fetched on demand into bin/ (gitignored) so no Node toolchain is required. layout.templ loads the local stylesheet instead of cdn.tailwindcss.com. Adds a Makefile with generate/css/build/run/test/clean targets. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
43
Makefile
Normal file
43
Makefile
Normal file
@@ -0,0 +1,43 @@
|
||||
# Veola build.
|
||||
#
|
||||
# Requires the `templ` CLI (go install github.com/a-h/templ/cmd/templ@latest).
|
||||
# The Tailwind standalone CLI is fetched on demand into bin/ (gitignored) — no
|
||||
# node toolchain required. static/css/tailwind.css is a committed build
|
||||
# artifact so a plain `go build` deploy still has styles; run `make css`
|
||||
# (or `make build`) after touching templates or static/css/input.css.
|
||||
|
||||
TAILWIND_VERSION := v3.4.17
|
||||
TAILWIND_BIN := bin/tailwindcss
|
||||
# linux-x64 only; change the asset name for other platforms.
|
||||
TAILWIND_URL := https://github.com/tailwindlabs/tailwindcss/releases/download/$(TAILWIND_VERSION)/tailwindcss-linux-x64
|
||||
TEMPL := $(shell go env GOPATH)/bin/templ
|
||||
|
||||
.PHONY: all generate css build run test clean
|
||||
|
||||
all: build
|
||||
|
||||
$(TAILWIND_BIN):
|
||||
mkdir -p bin
|
||||
curl -sL --fail $(TAILWIND_URL) -o $(TAILWIND_BIN)
|
||||
chmod +x $(TAILWIND_BIN)
|
||||
|
||||
# Compile Tailwind utilities (scanned from the .templ sources) into
|
||||
# static/css/tailwind.css. The hand-written component layer is app.css.
|
||||
css: $(TAILWIND_BIN)
|
||||
$(TAILWIND_BIN) -c tailwind.config.js -i static/css/input.css -o static/css/tailwind.css --minify
|
||||
|
||||
# Regenerate templ Go from the .templ sources.
|
||||
generate:
|
||||
$(TEMPL) generate
|
||||
|
||||
build: generate css
|
||||
go build -o veola-bin .
|
||||
|
||||
run: build
|
||||
./veola-bin -config config.toml
|
||||
|
||||
test:
|
||||
go test ./...
|
||||
|
||||
clean:
|
||||
rm -f veola-bin
|
||||
Reference in New Issue
Block a user