-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
59 lines (42 loc) · 1.36 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
include Make.config
.PHONY: build open init
project_name = $(notdir $(shell pwd))
UNAME = $(shell uname)
dist = $(shell pwd)/dist
devbin = ./node_modules/.bin
docker-serve/docker-compose.yml: docker-serve/docker-compose.yml.template
virtual_host=$(virtual_host) envsubst <$< >$@
build: node_modules app index $(dist)/app.css
index: $(dist)/index.html
$(dist)/app.css: app.less
$(devbin)/lessc $< >$@
app: $(dist)/app.js
node_modules: package.json
npm install
init:
git checkout -b master
mkdir dist
old-serve:
docker run --name $(project_name)-nginx -v $(dist):/usr/share/nginx/html:ro \
-e VIRTUAL_HOST=$(project_name).localhost -d nginx
serve: docker-serve/docker-compose.yml
docker-compose -p $(project_name) -f docker-serve/docker-compose.yml up nginx
stop-serve:
docker stop $(project_name)-nginx
$(dist)/app.js: app.coffee
$(devbin)/browserify --t coffeeify --debug $< -o $@
$(dist)/index.html: index.jade
$(devbin)/jade \
-P index.jade -o dist
open: $(dist)/index.html
ifeq ($(UNAME), Linux)
xdg-open "http://$(virtual_host)"
else
open "http://$(virtual_host)"
endif
watch: node_modules
$(devbin)/nodemon --exec "make build || true" -e "less jade coffee"
docker-watch: docker-serve/docker-compose.yml
docker-compose -p $(project_name) -f docker-serve/docker-compose.yml up buildenv
livereload:
$(devbin)/livereload ./dist -p $(livereload_port)