-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (44 loc) · 1.58 KB
/
Makefile
File metadata and controls
58 lines (44 loc) · 1.58 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
BUILD_DIR := build
IMG_DIR := resources/public/img
SRC_FILES := $(shell find src -type f)
CSS_FILES := $(shell find resources/css -type f)
IMG_FILES := $(shell find $(IMG_DIR) -type f)
TARGET_JS := $(BUILD_DIR)/js/main.js
TARGET_CSS := $(BUILD_DIR)/css/application.css
TARGET_CSS_DEV := resources/public/css/application.css
TARGET_IMG_FILES := $(patsubst $(IMG_DIR)/%, $(BUILD_DIR)/img/%, $(IMG_FILES))
default: build
repl:
npx shadow-cljs cljs-repl app
dev:
npx shadow-cljs watch app test
css: $(TARGET_CSS_DEV)
css-watch: $(TARGET_CSS_DEV)
fsevent_watch -F $(CSS_FILES) | xargs -I{} make $(TARGET_CSS_DEV)
build: $(TARGET_JS) $(TARGET_CSS) $(TARGET_IMG_FILES) index.html
release: stash build
git checkout master
@echo "Creating new gh-pages branch"
git branch -D gh-pages || echo ''
git checkout -b gh-pages
@echo "Creating release commit"
git add build index.html
git commit -m "Release"
@echo "Pushing release to GitHub"
git push -f origin gh-pages
git checkout master
$(TARGET_JS): $(SRC_FILES)
@echo "---- Building cljs"
shadow-cljs release prod
$(TARGET_CSS): $(CSS_FILES) $(SRC_FILES)
@echo "---- Building css"
npx postcss $< -o $@
$(TARGET_CSS_DEV): $(CSS_FILES)
npx tailwind build $^ -o $@
$(TARGET_IMG_FILES): $(BUILD_DIR)/img/%: $(IMG_DIR)/%
@[ -d build/img ] || mkdir build/img
cp $< $@
index.html: resources/public/index.html
cat $^ | sed 's|css/application.css|$(BUILD_DIR)/css/application.css|' | sed 's|js/app|$(BUILD_DIR)/js|' | sed 's|favicon.ico|./resources/public/favicon.ico|' > $@
stash:
@git diff --quiet || git stash save "Stash before release"