templ:
	templ generate --watch --proxy="http://localhost:3032" --open-browser=false

server:
	air \
	--build.cmd "go build -o tmp/bin/maot-shortner ./cmd/maot-shortner" \
	--build.bin "tmp/bin/maot-shortner" \
	--build.delay "100" \
	--build.exclude_dir "node_modules" \
	--build.include_ext "go" \
	--build.stop_on_error "false" \
	--misc.clean_on_exit true

tailwind-clean:
	tailwindcss -i ./web/resources/css/input.css -o ./web/static/css/output.css --clean

# Run tailwindcss to generate the styles.css bundle in watch mode.
tailwind-watch:
	tailwindcss -i ./web/resources/css/input.css -o ./web/static/css/output.css --watch

# Start development server
dev:
	make tailwind-clean
	make -j3 tailwind-watch templ server

# Build production docker image
build:
	docker build -f Dockerfile -t maot-shortner:latest .
