-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
57 lines (41 loc) · 1.89 KB
/
Makefile
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
SRC_DIR = src
DIST_DIR = dist
STYLE := $(wildcard src/style/*.css)
STYLE := $(STYLE) src/style/github-markdown-processed.css src/style/github.css
STYLE := $(filter-out src/style/github-markdown-base.css, $(STYLE))
SCRIPT := $(wildcard src/script/*.js)
SOCIAL := $(wildcard src/image/social/*.png)
ICON := $(wildcard src/image/icon/*.png)
MINIFIED_STYLE := $(STYLE:$(SRC_DIR)%=$(DIST_DIR)%)
MINIFIED_SCRIPT := $(SCRIPT:$(SRC_DIR)%=$(DIST_DIR)%)
BLOG_IMAGES := $(wildcard blog/post/*/content/*.png)
.PHONY: build clean docker-build docker-push crunch
build: src/style/github.css src/style/github-markdown-processed.css \
$(MINIFIED_STYLE) $(MINIFIED_SCRIPT) | dist
clean:
rm -rf dist node_modules src/style/github-markdown-base.css \
src/style/github-markdown-processed.css src/style/github.css
crunch:
$(foreach image,$(BLOG_IMAGES),$(shell zopflipng -y "$(image)" "$(image)"))
$(DIST_DIR)/style/%.css: $(SRC_DIR)/style/%.css
@mkdir -p $(dir $@)
node_modules/uglifycss/uglifycss $< --output $@
$(DIST_DIR)/script/%.js: $(SRC_DIR)/script/%.js
@mkdir -p $(dir $@)
cp $< $@
node_modules: package.json yarn.lock
yarn install
dist:
mkdir -p dist
src/style/github-markdown-processed.css: src/style/github-markdown-base.css
/usr/bin/env python3 utils/github_css_postprocess.py
src/style/github-markdown-base.css: node_modules
node_modules/generate-github-markdown-css/cli.js > src/style/github-markdown-base.css
src/style/github.css: node_modules
cp $(realpath node_modules/pygments-github-css/github.css) src/style/
docker-build: build
docker buildx build --platform linux/amd64 --progress=plain --tag philiptrauner/homepage-app:latest -f docker/app/Dockerfile .
docker buildx build --platform linux/amd64 --progress=plain --tag philiptrauner/homepage-web:latest -f docker/web/Dockerfile .
docker-push: docker-build
docker push philiptrauner/homepage-app:latest
docker push philiptrauner/homepage-web:latest