-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
77 lines (52 loc) · 1.51 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
73
74
75
76
JS = build/acorn.player.js
CSS = build/acorn.player.css
JS_SRC = $(shell find coffee | grep .coffee | sed 's/coffee\//build\/js-compiled\//g' | sed 's/\.coffee/\.js/g' )
all: build
.PHONY: clean test watch
test:
# probably broken?
@npm test
clean:
rm -rf -- build
# css
build/acorn.player.css: less/acorn-player.less
@mkdir -p `dirname $@`
@rm -f $@
node_modules/.bin/lessc $< $@
build/acorn.player.min.css: build/acorn.player.css
@mkdir -p `dirname $@`
@rm -f $@
cat $< | node_modules/.bin/cssmin > $@
# coffee
build/js-compiled/%.js: coffee/%.coffee
@mkdir -p `dirname $@`
@rm -f $@
node_modules/.bin/coffee -b -p -c $< > $@
# js
build/acorn.player.js: $(JS_SRC) package.json
#: $(shell node_modules/.bin/smash --list build/js-compiled/src/)
# use JS_SRC here because the index.js (for smash --list) is an intermediate
# file, which gets constructed.
@mkdir -p `dirname $@`
@rm -f $@
node_modules/.bin/smash build/js-compiled/src/ | node_modules/.bin/uglifyjs - -b indent-level=2 -o $@
# minification
build/%.min.js: build/%.js
@mkdir -p `dirname $@`
@rm -f $@
node_modules/.bin/uglifyjs $< > $@
# build
build: build/acorn.player.min.js build/acorn.player.min.css
# dist
dist: build
cp -r $< $@
# serve
serve:
@echo "Serving static files..."
@node_modules/.bin/http-server -p 8000
# watching
watch:
@echo "Serving static files..."
@node_modules/.bin/http-server -p 8000 &
@echo "Watching files for changes..."
@watchr -e "watch('(less|coffee|lib)\/.*\.(less|coffee|css)') { system 'make' }"