~sircmpwn/core.sr.ht

ref: 15de75273645326d6c07adb68059f94bc1d2d6a4 core.sr.ht/srht/Makefile -rw-r--r-- 950 bytes
15de7527Drew DeVault Add setup.py, move stuff into srht/ 4 years ago
                                                                                
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
# Run `make` to compile static assets
# Run `make watch` to recompile whenever a change is made

.PHONY: all static watch clean

SCRIPTS+=$(patsubst js/%.js,static/%.js,$(wildcard js/*.js))
_STATIC:=$(patsubst _static/%,static/%,$(wildcard _static/*))

SRHT_PATH?=/usr/lib/python3.6/site-packages/srht

static/%: _static/%
	@mkdir -p static/
	cp $< $@

static/main.css: scss/*.scss ${SRHT_PATH}/scss/*.scss
	@mkdir -p static/
	sassc -I${SRHT_PATH}/scss scss/main.scss $@

static/main.min.css: static/main.css
	node ${SRHT_PATH}/minify-css.js \
		static/main.css \
		static/main.min.css \
		"templates/*" "${SRHT_PATH}/templates/*"

static/%.js: js/%.js
	@mkdir -p static/
	cp $< $@

static: $(SCRIPTS) $(_STATIC) static/main.min.css

all: static

clean:
	rm -rf static

watch:
	while inotifywait \
		-e close_write js/ \
		-e close_write scss/ \
		-e close_write "${SRHT_PATH}"/scss/ \
		-e close_write _static/; \
		do make; done

.DEFAULT_GOAL=all