website/Makefile

57 lines
1.7 KiB
Makefile
Raw Permalink Normal View History

2025-04-13 22:41:32 +09:00
TW_VERSION=4.1.3
TW_BIN=./bin/tailwindcss
2025-05-24 12:01:37 +09:00
STYLE_SRC=./assets/style/global.css
STYLE_DIST=./assets/style/dist.css
2024-10-03 02:03:14 +09:00
2025-04-13 22:41:32 +09:00
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
TW_PLATFORM := macos-arm64
else ifeq ($(UNAME_S),Linux)
TW_PLATFORM := linux-x64
else
$(error "Unsupported OS: $(UNAME_S)")
endif
2024-10-03 02:03:14 +09:00
all: install
install: ## Download TailwindCSS binary and install other dependencies
@echo "Creating bin directory if it doesn't exist..."
2025-04-13 22:41:32 +09:00
mkdir -p ./bin
2024-10-03 02:03:14 +09:00
@echo "Downloading TailwindCSS binary..."
2025-04-13 22:41:32 +09:00
curl -sLo $(TW_BIN) https://github.com/tailwindlabs/tailwindcss/releases/download/v$(TW_VERSION)/tailwindcss-$(TW_PLATFORM)
2024-10-03 02:03:14 +09:00
@echo "Making TailwindCSS binary executable..."
2025-04-13 22:41:32 +09:00
chmod +x $(TW_BIN)
@echo "TailwindCSS is ready in $(TW_BIN)"
2024-10-03 02:03:14 +09:00
@echo "Installing qlot dependencies..."
@qlot install
2024-10-03 02:03:14 +09:00
watch: ## Start TailwindCSS in watch mode for automatic rebuilds
2025-04-13 22:41:32 +09:00
@$(TW_BIN) -i $(STYLE_SRC) -o $(STYLE_DIST) --watch=always
2024-10-03 02:03:14 +09:00
build: ## Generate the final CSS output
2025-04-13 22:41:32 +09:00
@$(TW_BIN) -i $(STYLE_SRC) -o $(STYLE_DIST)
2024-10-03 02:03:14 +09:00
help: ## Display available commands and their descriptions
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
2024-10-03 02:03:14 +09:00
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
clean: ## Remove the bin directory and clean up generated files
2025-04-13 22:41:32 +09:00
@echo "Removing ./bin..."
rm -rf ./bin
@echo "Removing qlot dependencies..."
rm -rf ./.qlot/
2024-11-15 09:51:29 +09:00
lem: ## Open Lem with TailwindCSS server
2024-11-17 00:59:06 +09:00
@echo "Starting TailwindCSS server in background..."
2024-11-15 09:51:29 +09:00
@make watch > /dev/null 2>&1 & \
WATCH_PID=$$!; \
trap "kill $$WATCH_PID" SIGINT SIGTERM EXIT; \
lem; \
2025-03-28 23:12:07 +09:00
kill $$WATCH_PID
2025-04-13 22:41:32 +09:00
docker-build: ## Build docker image
2025-05-02 09:39:55 +09:00
docker build -t website .
2025-03-28 23:12:07 +09:00
2025-04-13 22:41:32 +09:00
docker-run: ## Run docker container
2025-05-02 09:39:55 +09:00
docker run -p 3000:3000 website