Skip to content

Commit 8086be4

Browse files
committed
Local assets
1 parent 1833841 commit 8086be4

File tree

20 files changed

+124
-18
lines changed

20 files changed

+124
-18
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ jobs:
1717
- uses: actions/setup-go@v6
1818
with:
1919
go-version-file: go.mod
20+
- name: Install Tailwind CSS
21+
run: |
22+
mkdir -p bin
23+
curl -sL https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 -o bin/tailwindcss
24+
chmod +x bin/tailwindcss
25+
- name: Build CSS
26+
run: make tailwind
2027
- name: Install golangci-lint
2128
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
2229
- name: Lint
@@ -63,6 +70,13 @@ jobs:
6370
- uses: actions/setup-go@v6
6471
with:
6572
go-version-file: go.mod
73+
- name: Install Tailwind CSS
74+
run: |
75+
mkdir -p bin
76+
curl -sL https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 -o bin/tailwindcss
77+
chmod +x bin/tailwindcss
78+
- name: Build CSS
79+
run: make tailwind
6680
- name: Vet
6781
run: go vet ./...
6882

@@ -74,5 +88,12 @@ jobs:
7488
- uses: actions/setup-go@v6
7589
with:
7690
go-version-file: go.mod
91+
- name: Install Tailwind CSS
92+
run: |
93+
mkdir -p bin
94+
curl -sL https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 -o bin/tailwindcss
95+
chmod +x bin/tailwindcss
96+
- name: Build CSS
97+
run: make tailwind
7798
- name: Test
7899
run: go test -v ./...

.github/workflows/deploy.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ jobs:
3434
with:
3535
ref: ${{ inputs.ref }}
3636

37+
- name: Setup Go
38+
uses: actions/setup-go@v6
39+
with:
40+
go-version-file: go.mod
41+
42+
- name: Install Tailwind CSS
43+
run: |
44+
mkdir -p bin
45+
curl -sL https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 -o bin/tailwindcss
46+
chmod +x bin/tailwindcss
47+
3748
- name: Setup Python
3849
uses: actions/setup-python@v6
3950
with:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/wpcomposer
2+
/bin/
3+
internal/http/static/assets/styles/app.css
24
storage/
35
*.db
46
*.db-wal

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
.PHONY: build install dev test smoke lint clean
1+
.PHONY: build install dev test smoke lint clean tailwind
2+
3+
TAILWIND ?= ./bin/tailwindcss
4+
5+
# Generate CSS from templates
6+
tailwind:
7+
$(TAILWIND) -i internal/http/tailwind-input.css -o internal/http/static/assets/styles/app.css --minify
28

39
# Build the binary
4-
build:
10+
build: tailwind
511
go build -o wpcomposer ./cmd/wpcomposer
612

713
# Install to $GOPATH/bin

deploy/ansible/roles/app/tasks/deploy.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
group: www-data
1616
mode: "0775"
1717

18+
- name: Build CSS with Tailwind
19+
delegate_to: localhost
20+
become: false
21+
shell: >
22+
cd {{ playbook_dir }}/../.. &&
23+
make tailwind
24+
1825
- name: Build Go binary locally
1926
delegate_to: localhost
2027
become: false

internal/http/router.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ func NewRouter(a *app.App) chi.Router {
3636

3737
staticSub, _ := fs.Sub(staticFS, "static")
3838
staticServer := http.FileServer(http.FS(staticSub))
39-
for _, f := range []string{"/favicon.ico", "/icon.svg", "/icon-192.png", "/icon-512.png", "/apple-touch-icon.png", "/manifest.webmanifest", "/carrot.svg", "/kinsta.svg", "/wordpress-com.svg", "/itineris.svg"} {
39+
for _, f := range []string{"/favicon.ico", "/icon.svg", "/icon-192.png", "/icon-512.png", "/apple-touch-icon.png", "/manifest.webmanifest"} {
4040
r.Get(f, staticServer.ServeHTTP)
4141
}
42+
r.Get("/assets/*", staticServer.ServeHTTP)
4243

4344
// Ensure fallback OG image exists (uploads to R2 in production)
4445
ensureLocalFallbackOG(a.Config)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)