Makefile 4.1 KB
Newer Older
1
BOOTSTRAP = ./docs/assets/css/bootstrap.css
2
BOOTSTRAP_LESS = ./less/bootstrap.less
3
BOOTSTRAP_RESPONSIVE = ./docs/assets/css/bootstrap-responsive.css
4
BOOTSTRAP_RESPONSIVE_LESS = ./less/responsive.less
5
6
DATE=$(shell date +%I:%M%p)
CHECK=\033[32m✔\033[39m
Jacob Thornton's avatar
Jacob Thornton committed
7
HR=\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
8
9


10
#
11
# BUILD DOCS
12
13
#

14
build:
Jacob Thornton's avatar
Jacob Thornton committed
15
	@echo "\n${HR}"
16
	@echo "Building Bootstrap..."
Jacob Thornton's avatar
Jacob Thornton committed
17
	@echo "${HR}\n"
18
19
20
	@jshint js/*.js --config js/.jshintrc
	@jshint js/tests/unit/*.js --config js/.jshintrc
	@echo "Running JSHint on javascript...             ${CHECK} Done"
21
22
	@./node_modules/.bin/recess --compile ${BOOTSTRAP_LESS} > ${BOOTSTRAP}
	@./node_modules/.bin/recess --compile ${BOOTSTRAP_RESPONSIVE_LESS} > ${BOOTSTRAP_RESPONSIVE}
23
24
25
26
27
28
	@echo "Compiling LESS with Recess...               ${CHECK} Done"
	@node docs/build
	@cp img/* docs/assets/img/
	@cp js/*.js docs/assets/js/
	@cp js/tests/vendor/jquery.js docs/assets/js/
	@echo "Compiling documentation...                  ${CHECK} Done"
29
	@cat js/bootstrap-transition.js js/bootstrap-alert.js js/bootstrap-button.js js/bootstrap-carousel.js js/bootstrap-collapse.js js/bootstrap-dropdown.js js/bootstrap-modal.js js/bootstrap-tooltip.js js/bootstrap-popover.js js/bootstrap-scrollspy.js js/bootstrap-tab.js js/bootstrap-typeahead.js js/bootstrap-affix.js > docs/assets/js/bootstrap.js
30
	@./node_modules/.bin/uglifyjs -nc docs/assets/js/bootstrap.js > docs/assets/js/bootstrap.min.tmp.js
Mark Otto's avatar
Mark Otto committed
31
	@echo "/**\n* Bootstrap.js v2.2.3 by @fat & @mdo\n* Copyright 2012 Twitter, Inc.\n* http://www.apache.org/licenses/LICENSE-2.0.txt\n*/" > docs/assets/js/copyright.js
32
33
34
	@cat docs/assets/js/copyright.js docs/assets/js/bootstrap.min.tmp.js > docs/assets/js/bootstrap.min.js
	@rm docs/assets/js/copyright.js docs/assets/js/bootstrap.min.tmp.js
	@echo "Compiling and minifying javascript...       ${CHECK} Done"
Jacob Thornton's avatar
Jacob Thornton committed
35
	@echo "\n${HR}"
36
	@echo "Bootstrap successfully built at ${DATE}."
Jacob Thornton's avatar
Jacob Thornton committed
37
	@echo "${HR}\n"
38
39
40
	@echo "Thanks for using Bootstrap,"
	@echo "<3 @mdo and @fat\n"

41
#
42
# RUN JSHINT & QUNIT TESTS IN PHANTOMJS
43
44
45
#

test:
46
47
	./node_modules/.bin/jshint js/*.js --config js/.jshintrc
	./node_modules/.bin/jshint js/tests/unit/*.js --config js/.jshintrc
48
49
50
51
	node js/tests/server.js &
	phantomjs js/tests/phantom.js "http://localhost:3000/js/tests"
	kill -9 `cat js/tests/pid.txt`
	rm js/tests/pid.txt
52

53
54
55
56
57
58
59
#
# CLEANS THE ROOT DIRECTORY OF PRIOR BUILDS
#

clean:
	rm -r bootstrap

60
#
Jacob Thornton's avatar
Jacob Thornton committed
61
# BUILD SIMPLE BOOTSTRAP DIRECTORY
62
# recess & uglifyjs are required
63
64
#

Jacob Thornton's avatar
Jacob Thornton committed
65
66
67
68
69
bootstrap:
	mkdir -p bootstrap/img
	mkdir -p bootstrap/css
	mkdir -p bootstrap/js
	cp img/* bootstrap/img/
70
71
72
73
	./node_modules/.bin/recess --compile ${BOOTSTRAP_LESS} > bootstrap/css/bootstrap.css
	./node_modules/.bin/recess --compress ${BOOTSTRAP_LESS} > bootstrap/css/bootstrap.min.css
	./node_modules/.bin/recess --compile ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.css
	./node_modules/.bin/recess --compress ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.min.css
Jacob Thornton's avatar
Jacob Thornton committed
74
	cat js/bootstrap-transition.js js/bootstrap-alert.js js/bootstrap-button.js js/bootstrap-carousel.js js/bootstrap-collapse.js js/bootstrap-dropdown.js js/bootstrap-modal.js js/bootstrap-tooltip.js js/bootstrap-popover.js js/bootstrap-scrollspy.js js/bootstrap-tab.js js/bootstrap-typeahead.js js/bootstrap-affix.js > bootstrap/js/bootstrap.js
75
	./node_modules/.bin/uglifyjs -nc bootstrap/js/bootstrap.js > bootstrap/js/bootstrap.min.tmp.js
76
	echo "/*!\n* Bootstrap.js by @fat & @mdo\n* Copyright 2012 Twitter, Inc.\n* http://www.apache.org/licenses/LICENSE-2.0.txt\n*/" > bootstrap/js/copyright.js
Jacob Thornton's avatar
Jacob Thornton committed
77
78
	cat bootstrap/js/copyright.js bootstrap/js/bootstrap.min.tmp.js > bootstrap/js/bootstrap.min.js
	rm bootstrap/js/copyright.js bootstrap/js/bootstrap.min.tmp.js
79
80

#
81
# MAKE FOR GH-PAGES 4 FAT & MDO ONLY (O_O  )
82
#
83

84
gh-pages: bootstrap docs
85
	rm -f docs/assets/bootstrap.zip
86
87
	zip -r docs/assets/bootstrap.zip bootstrap
	rm -r bootstrap
Jacob Thornton's avatar
Jacob Thornton committed
88
	rm -f ../bootstrap-gh-pages/assets/bootstrap.zip
89
	node docs/build production
90
91
	cp -r docs/* ../bootstrap-gh-pages

92
93
94
95
#
# WATCH LESS FILES
#

96
watch:
97
98
99
100
	echo "Watching less files..."; \
	watchr -e "watch('less/.*\.less') { system 'make' }"


Jacob Thornton's avatar
Jacob Thornton committed
101
.PHONY: docs watch gh-pages