-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (28 loc) · 907 Bytes
/
Makefile
File metadata and controls
35 lines (28 loc) · 907 Bytes
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
css=$(shell ls dist/*.css)
js=$(shell ls dist/*.js)
css_file=$(notdir $(css))
js_file=$(notdir $(js))
html_file=dist/index.html
DOMAIN=tinychart.co
all:
@echo "use 'make build' or 'make deploy'"
prepare-dist:
@mkdir -p dist
@touch dist/CNAME
@echo $(DOMAIN) > dist/CNAME
dev-html:
@cp index.html.tpl index.html
@sed -i "" "s/{{MAINCSS}}/styles\/app.css/g" index.html
@sed -i "" "s/{{MAINJS}}/browser-bundle.js/g" index.html
build: prepare-dist
@echo "building dist version..."
@cp index.html.tpl $(html_file)
@echo "inserting compiled css and js into index.html..."
@sed -i "" "s/{{MAINCSS}}/$(subst /,\\/,${css_file})/g" $(html_file)
@sed -i "" "s/{{MAINJS}}/$(subst /,\\/,${js_file})/g" $(html_file)
@say build done
deploy: build
@echo "deploying dist/ to gh-pages remote branch..."
git subtree push --prefix dist origin gh-pages
@say deploy done
.PHONY: prepare-dist build deploy