This repository was archived by the owner on Sep 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
57 lines (43 loc) · 1.66 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
export PATH := ./node_modules/.bin:$(PATH)
export SHELL := /bin/bash
source_dir = src
source_js_path = $(source_dir)/js
source_css_path = $(source_dir)/css
source_index = $(source_dir)/index.html
source_js_files = $(shell find $(source_js_path) -name "*.js")
source_app_js = $(source_js_path)/client.js
source_sw_js = $(source_js_path)/service_worker.js
source_css_files = $(shell find $(source_css_path) -name "*.styl")
source_main_css = $(source_css_path)/main.styl
app_index = build/index.html
app_js = build/js/main.js
sw_js = build/sw.js
app_css = build/css/main.css
build_dir = build
js_debug := --debug
css_debug := --sourcemap-inline
.PHONY: all all_production watch clean production
all: $(app_index) $(sw_js) $(app_js) $(app_css)
watch: clean all
watchy -w $(source_js_path),$(source_css_path) -- make all
clean:
rm -rf build
rm -rf production
# deactivate debugging flags for production
production: js_debug =
production: css_debug =
production: clean $(app_index) $(sw_js) $(app_js) $(app_css)
$(app_index):
mkdir -p $(build_dir)
cp $(source_index) $(app_index)
#$(sw_js): app_version = $(shell git log -n 1 --format=oneline|head -n 1|cut -d " " -f 1)
$(sw_js):
cp $(source_sw_js) $@
#sed -e 's/<CACHE_NAME_VERSION>/$(app_version)/g' $(source_sw_js) > $@
$(app_js): $(source_js_files)
mkdir -p $(dir $@)
browserify $(js_debug) -t babelify $(source_app_js) > $@
cp $(source_js_path)/serviceworker-cache-polyfill.js build/js/
$(app_css): $(source_css_files)
mkdir -p $(dir $@)
stylus $(css_debug) --include $(source_css_path) < $(source_main_css) > $(app_css)