Skip to content

Instantly share code, notes, and snippets.

@therealparmesh
Created March 16, 2024 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save therealparmesh/5e62c00309455f3e6a4b2420d7a51879 to your computer and use it in GitHub Desktop.
Save therealparmesh/5e62c00309455f3e6a4b2420d7a51879 to your computer and use it in GitHub Desktop.
Go + Bun + HTMX + Tailwind Makefile
.PHONY: setup dev build
setup:
@echo "Checking for go..."
@command -v go >/dev/null 2>&1 || { echo >&2 "go is not installed. Aborting."; exit 1; }
@echo "Checking for bun..."
@command -v bun >/dev/null 2>&1 || { echo >&2 "bun is not installed. Aborting."; exit 1; }
@echo "Checking for air..."
@command -v air >/dev/null 2>&1 || { echo >&2 "air is not installed. Please install it by running 'go install github.com/cosmtrek/air@latest'. Aborting."; exit 1; }
@echo "Running go mod tidy..."
@go mod tidy
@echo "Running bun install..."
@bun install
dev:
@echo "Starting development environment..."
@# Run air for live reloading, Tailwind in watch mode, and Bun build for TS in watch mode simultaneously
@air & \
bun run tailwindcss -i ./path/to/input.css -o ./path/to/output.css --watch & \
bun build ./path/to/entrypoint.ts --watch
build:
@echo "Building project..."
@# Build the CSS via Tailwind with minification
@bun run tailwindcss -i ./path/to/input.css -o ./path/to/output.css --minify
@# Build the TypeScript with Bun with minification
@bun build ./path/to/entrypoint.ts --outDir ./dist --minify
@# Build the Go project
@go build -o ./bin/yourAppName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment