Skip to content

Commit 2eefb46

Browse files
authored
Set tailwindcss binary file name depending on current os (#125)
* Download tailwindcss arm64 binary if on macOS * add tailwind binary download for macos x64 or arm64
1 parent fd6218c commit 2eefb46

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

Makefile

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
1-
# The Tailwind CSS CLI package to install (pick the one that matches your OS: https://github.com/tailwindlabs/tailwindcss/releases/latest)
2-
TAILWIND_PACKAGE = tailwindcss-linux-x64
1+
# Get the OS name in lowercase (linux, darwin)
2+
OS_SYSNAME := $(shell uname -s | tr A-Z a-z)
3+
# Get the machine architecture (x86_64, arm64)
4+
OS_MACHINE := $(shell uname -m)
5+
6+
# If mac OS, use `macos-arm64` or `macos-x64`
7+
ifeq ($(OS_SYSNAME),darwin)
8+
OS_SYSNAME = macos
9+
ifneq ($(OS_MACHINE),arm64)
10+
OS_MACHINE = x64
11+
endif
12+
endif
13+
14+
# If Linux, use `linux-x64`
15+
ifeq ($(OS_SYSNAME),linux)
16+
OS_MACHINE = x64
17+
endif
18+
19+
TAILWIND_PACKAGE = tailwindcss-$(OS_SYSNAME)-$(OS_MACHINE)
320

421
.PHONY: help
522
help: ## Print make targets
@@ -59,4 +76,4 @@ css: ## Build and minify Tailwind CSS
5976

6077
.PHONY: build
6178
build: css ## Build CSS and compile the application binary
62-
go build -o ./tmp/main ./cmd/web
79+
go build -o ./tmp/main ./cmd/web

0 commit comments

Comments
 (0)