-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
139 lines (121 loc) · 3.4 KB
/
Taskfile.yml
File metadata and controls
139 lines (121 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
version: '3'
vars:
TAILWIND_VERSION: v3.4.17
TAILWIND_URL_DARWIN_ARM64: https://github.com/tailwindlabs/tailwindcss/releases/download/{{.TAILWIND_VERSION}}/tailwindcss-macos-arm64
TAILWIND_URL_DARWIN_AMD64: https://github.com/tailwindlabs/tailwindcss/releases/download/{{.TAILWIND_VERSION}}/tailwindcss-macos-x64
TAILWIND_URL_LINUX_AMD64: https://github.com/tailwindlabs/tailwindcss/releases/download/{{.TAILWIND_VERSION}}/tailwindcss-linux-x64
TAILWIND_URL_LINUX_ARM64: https://github.com/tailwindlabs/tailwindcss/releases/download/{{.TAILWIND_VERSION}}/tailwindcss-linux-arm64
tasks:
install:templ:
desc: Install templ CLI
cmds:
- go install github.com/a-h/templ/cmd/templ@latest
status:
- command -v templ
install:air:
desc: Install air for hot reload
cmds:
- go install github.com/air-verse/air@latest
status:
- command -v air
install:tailwind:
desc: Download Tailwind CSS standalone CLI
cmds:
- |
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
if [ "$OS" = "darwin" ]; then
if [ "$ARCH" = "arm64" ]; then
URL="{{.TAILWIND_URL_DARWIN_ARM64}}"
else
URL="{{.TAILWIND_URL_DARWIN_AMD64}}"
fi
elif [ "$OS" = "linux" ]; then
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
URL="{{.TAILWIND_URL_LINUX_ARM64}}"
else
URL="{{.TAILWIND_URL_LINUX_AMD64}}"
fi
else
echo "Unsupported OS: $OS"
exit 1
fi
echo "Downloading Tailwind CSS from $URL"
curl -sLO $URL
chmod +x tailwindcss-*
mv tailwindcss-* tailwindcss
status:
- test -f tailwindcss
install:
desc: Install all dependencies
deps:
- install:templ
- install:air
- install:tailwind
generate:templ:
desc: Generate Go code from Templ templates
cmds:
- templ generate
sources:
- templates/**/*.templ
generates:
- templates/**/*_templ.go
build:css:
desc: Build Tailwind CSS
cmds:
- ./tailwindcss -i ./static/css/input.css -o ./static/css/output.css --minify
sources:
- static/css/input.css
- tailwind.config.js
- templates/**/*.templ
generates:
- static/css/output.css
build:css:watch:
desc: Build Tailwind CSS in watch mode
cmds:
- ./tailwindcss -i ./static/css/input.css -o ./static/css/output.css --watch
build:
desc: Build the application
deps:
- generate:templ
- build:css
cmds:
- go build -o bin/app .
dev:
desc: Run the application with hot reload
deps:
- install:air
- install:tailwind
cmds:
- air
run:
desc: Build and run the application
deps:
- build
cmds:
- ./bin/app
clean:
desc: Clean generated files
cmds:
- rm -rf templates/**/*_templ.go
- rm -rf static/css/output.css
- rm -rf bin/
- rm -rf tmp/
docker:build:
desc: Build Docker production image
cmds:
- task: generate:templ
- task: build:css
- docker build -t website:latest .
docker:up:
desc: Start Docker Compose services
cmds:
- docker-compose up -d
docker:down:
desc: Stop Docker Compose services
cmds:
- docker-compose down
docker:logs:
desc: View Docker Compose logs
cmds:
- docker-compose logs -f