-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (71 loc) · 1.66 KB
/
Makefile
File metadata and controls
84 lines (71 loc) · 1.66 KB
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
84
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: watch-example
@$(BIN)/serve
watch-example:
@$(BIN)/watchify \
-v \
-g coffeeify \
--extension=".coffee" \
--outfile example/bundle.js \
--debug \
example/index.js &
js:
@$(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:
@$(BIN)/stylus \
--include-css \
--print \
lib/styles/index.styl \
| $(BIN)/cleancss \
--s0 \
--output kd.css
clean: clean_dist
@rm -fr build
clean_dist:
@rm -fr dist
.PHONY: example dist