This repository has been archived by the owner on Nov 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Makefile
83 lines (71 loc) · 1.73 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
77
78
79
80
81
82
83
BIN=./node_modules/.bin
SRC=$(shell find lib -name "*.coffee")
TARGETS=$(patsubst %.coffee,build/%.js,$(SRC))
all: clean prepublish dist
dist: clean_dist js css
@mkdir -p dist
@mv kd.* dist
prepublish: $(TARGETS)
build/%.js: %.coffee
@mkdir -p $(@D)
@$(BIN)/coffee -p -b $< >$@
@echo 'written $@'
development-dist:
@$(BIN)/watchify \
-v \
-g coffeeify \
--extension=".coffee" \
--outfile kd.js \
--standalone kd \
--debug \
lib/index.coffee
development: $(TARGETS)
@echo "watching kd.js/lib"
@node -e "\
var chokidar = require('chokidar'); \
var child_process = require('child_process'); \
var rimraf = require('rimraf'); \
var w = chokidar.watch('./lib/**/*.coffee', { persistent: true }); \
w.on('change', function (path) { \
console.log('changed ' + path); \
rimraf.sync('./build/' + path.replace('coffee', 'js')); \
child_process.exec('make build/' + path.replace('coffee', 'js'), \
function (err, stdout) { \
if (err) return console.log(err); \
process.stdout.write(stdout); \
}); \
});"
example: dist
@echo ' - Running example server...'
@cp ./dist/kd.js examples/
@cp ./dist/kd.css examples/
@$(BIN)/serve examples -o
js:
@echo ' - Browserify and Uglify...'
@$(BIN)/browserify \
-g coffeeify \
--extension=".coffee" \
--outfile kd.js \
--standalone kd \
index.coffee
@$(BIN)/uglifyjs kd.js \
--mangle -c hoist_vars=true,if_return=true \
--screw-ie8 \
-o kd.min.js
css:
@echo ' - Stylus and clean-css...'
@$(BIN)/stylus \
--include-css \
--print \
lib/styles/index.styl \
| $(BIN)/cleancss \
-O0 \
-o kd.css
clean: clean_dist
@rm -fr build
@rm -fr coverage
clean_dist:
@echo ' - Cleanup...'
@rm -fr dist
@rm -f examples/kd.*
.PHONY: example dist