-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (51 loc) · 1.18 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
64
65
66
67
68
69
70
71
72
#
# Binaries
#
BIN := ./node_modules/.bin
#
# Variables
#
HOST ?= localhost
PORT ?= 8080
SCRIPTS = $(shell find source -type f -name '*.js')
STYLES = $(shell find source -type f -name '*.css')
ASSETS = build/index.html build/404.html
TRANSFORMS = -t [ babelify ]
BROWSERS = "last 2 versions"
#
# Tasks
#
build: assets scripts styles
watch: install
@budo source/js/index.js:assets/bundle.js -d build -H $(HOST) --port $(PORT) -l -- $(TRANSFORMS) & \
cssnext --watch source/css/index.css build/assets/bundle.css & \
onchange "./**/*.{html,jpg,jpeg,png,gif}" -- make assets & wait
install: node_modules
clean:
@rm -rf build
clean-deps:
@rm -rf node_modules/
#
# Shorthands
#
assets: $(ASSETS)
scripts: build/assets/bundle.js
styles: build/assets/bundle.css
#
# Targets
#
node_modules: package.json
@npm install
build/%: source/%
@mkdir -p $(@D)
@cp $< $@
build/assets/%.js: $(SCRIPTS)
@mkdir -p $(@D)
@browserify $(TRANSFORMS) source/js/index.js -o $@
build/assets/%.css: $(STYLES)
@mkdir -p $(@D)
@cssnext --browsers $(BROWSERS) --sourcemap $< $@
#
# These tasks will be run every time regardless of dependencies.
#
.PHONY: develop clean clean-deps