-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (48 loc) · 1.88 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
.PHONY: all clean watch
NODE := $(shell which node)
LESSC := node_modules/.bin/lessc
HANDLEBARS := node_modules/.bin/handlebars
POSTCSS := scripts/postcss.js
lessfiles := $(shell find css/ -name "*.less")
cssfiles := $(lessfiles:%.less=%.css)
handlebars := $(shell find views/ -name "*.hbs")
allcss = $(shell find css/ -name "*.css" \
| grep -v 'reset.css')
alljs = $(shell echo "main.js" \
&& find {config,controllers,handlers,locales,library,models,turtl} -name "*.js" \
| grep -v '(ignore|\.thread\.)')
testsjs = $(shell find tests/{data,tests} -name "*.js")
all: $(cssfiles) library/templates.js library/svg-icons.js .build/postcss index.html
%.css: %.less
@echo "- LESS:" $< "->" $@
@$(LESSC) --include-path=css/ $< > $@
library/templates.js: $(handlebars)
@echo "- Handlebars: " $?
@$(HANDLEBARS) -r views -e "hbs" -n "TurtlTemplates" -f $@ $^
@echo 'var TurtlTemplates = {};' > .build/templates.js
@cat $@ >> .build/templates.js
@mv .build/templates.js $@
library/svg-icons.js:
@./scripts/index-icons
.build/postcss: $(allcss) $(cssfiles)
@echo "- postcss:" $?
@$(NODE) $(POSTCSS) --use autoprefixer --replace $?
@touch $@
index.html: $(allcss) $(alljs) $(cssfiles) library/templates.js views/layouts/default.html .build/postcss scripts/include.sh scripts/gen-index
@echo "- index.html: " $?
@./scripts/gen-index
tests/index.html: $(testsjs) index.html tests/scripts/gen-index
@echo "- tests/index.html: " $?
@./tests/scripts/gen-index
clean:
rm -f $(allcss)
rm -f library/templates.js
rm -f library/svg-icons.js
rm -f .build/*
rm -f index.html
watch:
@./scripts/watch
min.index.html: $(allcss) $(alljs) $(cssfiles) library/templates.js views/layouts/default.html .build/postcss scripts/include.sh scripts/gen-minified-index
@echo "- index.html: " $?
@./scripts/gen-minified-index
minify: $(cssfiles) library/templates.js library/svg-icons.js .build/postcss min.index.html