forked from tsoding/schedule
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (48 loc) · 1.77 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
58
59
60
61
62
63
TSS=$(shell find ./ts/ -type f -name '*.ts')
BROWSERIFY=./node_modules/.bin/browserify
WATCHIFY=./node_modules/.bin/watchify
SASS=./node_modules/.bin/sass
SASS_FLAGS=--load-path=node_modules/@fortawesome/fontawesome-free/scss
SASS_BUILD_FLAGS=$(SASS_FLAGS) --no-source-map
SASS_WATCH_FLAGS=$(SASS_FLAGS) --watch
STATIC=html/index.html css/reset.css json/schedule.json
# PRODUCTION ##############################
.PHONY: all
all: dist/app.js dist/index.html dist/reset.css dist/main.css dist/schedule.json
dist/app.js: dist $(TSS)
$(BROWSERIFY) ./ts/app.ts -p tsify -g uglifyify --outfile dist/app.js
dist/index.html: dist html/index.html
cp html/index.html dist/
dist/reset.css: dist css/reset.css
cp css/reset.css dist/
dist/main.css: dist scss/main.scss
mkdir -p dist/webfonts
cp node_modules/@fortawesome/fontawesome-free/webfonts/* dist/webfonts/
$(SASS) $(SASS_BUILD_FLAGS) scss/main.scss dist/main.css
dist/schedule.json: dist json/schedule.json
jq -c . json/schedule.json > dist/schedule.json
dist:
mkdir -p dist
# DEVELOPMENT ##############################
.PHONY: watch
watch: watch-ts watch-scss watch-static http-server
.PHONY: watch-ts
watch-ts: dist $(TSS)
$(WATCHIFY) ./ts/app.ts -v -p [ browserify-livereload --host 127.0.0.1 --port 1337 ] -p tsify --outfile dist/app.js --debug
.PHONY: watch-scss
watch-scss: dist scss/main.scss
mkdir -p dist/webfonts
cp node_modules/@fortawesome/fontawesome-free/webfonts/* dist/webfonts/
$(SASS) $(SASS_WATCH_FLAGS) scss/main.scss dist/main.css
.PHONY: watch-static
watch-static: dist $(STATIC)
cp $(STATIC) dist/
while inotifywait -q -e modify,move_self $(STATIC); do \
cp $(STATIC) dist/; \
done
.PHONY: http-server
http-server: dist
python server.py 8080
.PHONY: clean
clean:
rm -rfv dist/