29 lines
834 B
Makefile
29 lines
834 B
Makefile
# List of all .templ files
|
|
TEMPL_FILES := $(wildcard *.templ)
|
|
|
|
# Name of the generated file(s) from templ
|
|
GENERATED_FILES := $(TEMPL_FILES:.templ=_templ.go)
|
|
|
|
# Generate Go files from .templ files only if they have changed
|
|
$(GENERATED_FILES): $(TEMPL_FILES)
|
|
templ generate
|
|
|
|
TAILWIND_CONFIG := tailwind.config.js
|
|
INPUT_CSS := input.css
|
|
OUTPUT_CSS := static/output.css
|
|
|
|
# generate tailwindcss output
|
|
$(OUTPUT_CSS): $(TEMPL_FILES) $(TAILWIND_CONFIG) $(INPUT_CSS)
|
|
tailwindcss -i $(INPUT_CSS) -o $(OUTPUT_CSS)
|
|
|
|
# Run the server, with dependencies on templ and tailwind generation
|
|
run: $(GENERATED_FILES) $(OUTPUT_CSS)
|
|
go run .
|
|
|
|
# this uses wgo to re-execute 'make run'
|
|
# which will toggle templ generate, when needed
|
|
# and then do `go run .` to rebuild all else
|
|
.PHONY: run/live
|
|
run/live:
|
|
wgo -verbose -file=.go -file=.templ make run
|