From 36217a3fd0e4766ca9aee8179253ddb3364ca2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Thu, 21 Feb 2013 14:08:52 +0100 Subject: [PATCH 01/13] Use local jshint installation. Fixes build errors when jshint is not installed globally. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 57393d1049..218f2af16d 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,8 @@ build: @echo "\n\n" @echo "\033[36mBuilding Bootstrap...\033[39m" @echo "${HR}" - @jshint js/*.js --config js/.jshintrc - @jshint js/tests/unit/*.js --config js/.jshintrc + @./node_modules/.bin/jshint js/*.js --config js/.jshintrc + @./node_modules/.bin/jshint js/tests/unit/*.js --config js/.jshintrc @echo "Running JSHint on javascript... ${CHECK}" @./node_modules/.bin/recess --compile ${BOOTSTRAP_LESS} > ${BOOTSTRAP} @echo "Compiling LESS with Recess... ${CHECK}" -- GitLab From 695b112cc21776a2be5984dcc89d184f557b3161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Thu, 21 Feb 2013 14:14:16 +0100 Subject: [PATCH 02/13] Make it easier to use global binaries. You can now set BIN_PREFIX if you'd rather use a global install of node.js. You can also specify JSHINT_BIN, RECESS_BIN and UGLIFYJS_BIN to use global or local installs as you like --- Makefile | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 218f2af16d..6482d8314b 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,10 @@ BOOTSTRAP_LESS = ./less/bootstrap.less DATE=$(shell date +%I:%M%p) CHECK=\033[32m✔ Done\033[39m HR=\033[37m--------------------------------------------------\033[39m +BIN_PREFIX=./node_modules/.bin +JSHINT_BIN=$(BIN_PREFIX)/jshint +RECESS_BIN=$(BIN_PREFIX)/recess +UGLIFYJS_BIN=$(BIN_PREFIX)/uglifyjs # # BUILD DOCS @@ -12,17 +16,17 @@ build: @echo "\n\n" @echo "\033[36mBuilding Bootstrap...\033[39m" @echo "${HR}" - @./node_modules/.bin/jshint js/*.js --config js/.jshintrc - @./node_modules/.bin/jshint js/tests/unit/*.js --config js/.jshintrc + @$(JSHINT_BIN) js/*.js --config js/.jshintrc + @$(JSHINT_BIN) js/tests/unit/*.js --config js/.jshintrc @echo "Running JSHint on javascript... ${CHECK}" - @./node_modules/.bin/recess --compile ${BOOTSTRAP_LESS} > ${BOOTSTRAP} + @$(RECESS_BIN) --compile ${BOOTSTRAP_LESS} > ${BOOTSTRAP} @echo "Compiling LESS with Recess... ${CHECK}" @cp fonts/* docs/assets/fonts/ @cp js/*.js docs/assets/js/ @cp js/tests/vendor/jquery.js docs/assets/js/ @echo "Prepping fonts and JavaScript... ${CHECK}" @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 - @./node_modules/.bin/uglifyjs -nc docs/assets/js/bootstrap.js > docs/assets/js/bootstrap.min.tmp.js + @$(UGLIFYJS_BIN) -nc docs/assets/js/bootstrap.js > docs/assets/js/bootstrap.min.tmp.js @echo "/**\n* Bootstrap.js v3.0.0 by @fat & @mdo\n* Copyright 2012 Twitter, Inc.\n* http://www.apache.org/licenses/LICENSE-2.0.txt\n*/" > docs/assets/js/copyright.js @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 @@ -37,8 +41,8 @@ build: # test: - ./node_modules/.bin/jshint js/*.js --config js/.jshintrc - ./node_modules/.bin/jshint js/tests/unit/*.js --config js/.jshintrc + $(JSHINT_BIN) js/*.js --config js/.jshintrc + $(JSHINT_BIN) js/tests/unit/*.js --config js/.jshintrc node js/tests/server.js & phantomjs js/tests/phantom.js "http://localhost:3000/js/tests" kill -9 `cat js/tests/pid.txt` @@ -67,7 +71,7 @@ bootstrap-js: bootstrap/js/*.js bootstrap/js/*.js: js/*.js mkdir -p bootstrap/js 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 - ./node_modules/.bin/uglifyjs -nc bootstrap/js/bootstrap.js > bootstrap/js/bootstrap.min.tmp.js + $(UGLIFYJS_BIN) -nc bootstrap/js/bootstrap.js > bootstrap/js/bootstrap.min.tmp.js 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 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 @@ -80,10 +84,10 @@ bootstrap-css: bootstrap/css/*.css bootstrap/css/*.css: less/*.less mkdir -p bootstrap/css - ./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 + $(RECESS_BIN) --compile ${BOOTSTRAP_LESS} > bootstrap/css/bootstrap.css + $(RECESS_BIN) --compress ${BOOTSTRAP_LESS} > bootstrap/css/bootstrap.min.css + $(RECESS_BIN) --compile ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.css + $(RECESS_BIN) --compress ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.min.css # # FONTS -- GitLab From 3ecd559ce5d5fa6f0f9af13c692155b051ced659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Thu, 21 Feb 2013 14:19:16 +0100 Subject: [PATCH 03/13] Ignore errors if running make clean on clean repo Mostly a cosmetic change, although it should now be work as expected to run for example "make clean bootstrap" on a clean install. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6482d8314b..c696c8d6ad 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ test: # clean: - rm -r bootstrap + -rm -r bootstrap # # BUILD SIMPLE BOOTSTRAP DIRECTORY -- GitLab From 61f681a7802b89fc7af5fb2a7e2774b74d5d135e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Thu, 21 Feb 2013 14:22:52 +0100 Subject: [PATCH 04/13] Corrected .PHONY targets list --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c696c8d6ad..c376e1d1ea 100644 --- a/Makefile +++ b/Makefile @@ -121,4 +121,4 @@ watch: watchr -e "watch('less/.*\.less') { system 'make' }" -.PHONY: docs watch gh-pages bootstrap-img bootstrap-css bootstrap-js +.PHONY: build test clean bootstrap bootstrap-js bootstrap-css bootstrap-fonts gh-pages watch -- GitLab From ff8fc7553ef3839111253c3cff67b0cc0f09864d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Thu, 21 Feb 2013 14:23:47 +0100 Subject: [PATCH 05/13] Removed docs dependency from gh-pages target That target does not exist, so having it as a dependency does nothing. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c376e1d1ea..84de52adc3 100644 --- a/Makefile +++ b/Makefile @@ -104,7 +104,7 @@ bootstrap/fonts/*: fonts/* # MAKE FOR GH-PAGES 4 FAT & MDO ONLY (O_O ) # -gh-pages: bootstrap docs +gh-pages: bootstrap rm -f docs/assets/bootstrap.zip zip -r docs/assets/bootstrap.zip bootstrap rm -r bootstrap -- GitLab From 359397fec4fd3aa1a8d8713a2cfb923b6f325ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Thu, 21 Feb 2013 14:27:33 +0100 Subject: [PATCH 06/13] Silence call to echo --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 84de52adc3..db328c0090 100644 --- a/Makefile +++ b/Makefile @@ -117,7 +117,7 @@ gh-pages: bootstrap # watch: - echo "Watching less files..."; \ + @echo "Watching less files..."; \ watchr -e "watch('less/.*\.less') { system 'make' }" -- GitLab From 10e8efe3cfa1c839abe71bc0cd45076a095d2a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Thu, 21 Feb 2013 14:33:36 +0100 Subject: [PATCH 07/13] Fix typo in comment --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index db328c0090..52187151cd 100644 --- a/Makefile +++ b/Makefile @@ -77,7 +77,7 @@ bootstrap/js/*.js: js/*.js rm bootstrap/js/copyright.js bootstrap/js/bootstrap.min.tmp.js # -# CSS COMPLILE +# CSS COMPILE # bootstrap-css: bootstrap/css/*.css -- GitLab From 1a475b0161d917d8c39d4318b9a07bb43832e928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Sun, 10 Mar 2013 16:10:57 +0100 Subject: [PATCH 08/13] Move trailing slash to BIN_PREFIX This allows you to set BIN_PREFIX to "" to use globally installed node modules, as suggested by nextgenthemes --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 52187151cd..3478af356f 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,10 @@ BOOTSTRAP_LESS = ./less/bootstrap.less DATE=$(shell date +%I:%M%p) CHECK=\033[32m✔ Done\033[39m HR=\033[37m--------------------------------------------------\033[39m -BIN_PREFIX=./node_modules/.bin -JSHINT_BIN=$(BIN_PREFIX)/jshint -RECESS_BIN=$(BIN_PREFIX)/recess -UGLIFYJS_BIN=$(BIN_PREFIX)/uglifyjs +BIN_PREFIX=./node_modules/.bin/ +JSHINT_BIN=$(BIN_PREFIX)jshint +RECESS_BIN=$(BIN_PREFIX)recess +UGLIFYJS_BIN=$(BIN_PREFIX)uglifyjs # # BUILD DOCS -- GitLab From e95e12545cb8098eed7566b6b5e3681d9b932383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Fri, 1 Mar 2013 16:34:04 +0100 Subject: [PATCH 09/13] Only run jshint if js files have changed This will still run jshint on all files, not only the ones that have changed. This commit also separates out the initial splash screen to a separate target, to be able to run it before jshint. --- .gitignore | 3 +++ Makefile | 21 +++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index ace28e663f..bd1f401e0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Ignore jshint build timestamp +js/.lastbuilt + # Ignore compiled docs _gh_pages diff --git a/Makefile b/Makefile index 3478af356f..3526cf1b64 100644 --- a/Makefile +++ b/Makefile @@ -12,15 +12,9 @@ UGLIFYJS_BIN=$(BIN_PREFIX)uglifyjs # BUILD DOCS # -build: - @echo "\n\n" - @echo "\033[36mBuilding Bootstrap...\033[39m" - @echo "${HR}" - @$(JSHINT_BIN) js/*.js --config js/.jshintrc - @$(JSHINT_BIN) js/tests/unit/*.js --config js/.jshintrc - @echo "Running JSHint on javascript... ${CHECK}" @$(RECESS_BIN) --compile ${BOOTSTRAP_LESS} > ${BOOTSTRAP} @echo "Compiling LESS with Recess... ${CHECK}" +build: splash js/.lastbuilt @cp fonts/* docs/assets/fonts/ @cp js/*.js docs/assets/js/ @cp js/tests/vendor/jquery.js docs/assets/js/ @@ -36,6 +30,16 @@ build: @echo "\033[37mThanks for using Bootstrap," @echo "<3 @mdo and @fat\n\033[39m" +splash: + @echo "\n\n" + @echo "\033[36mBuilding Bootstrap...\033[39m" + @echo "${HR}" + +js/.lastbuilt: js/*.js + @$(JSHINT_BIN) js/*.js --config js/.jshintrc + @$(JSHINT_BIN) js/tests/unit/*.js --config js/.jshintrc + @touch js/.lastbuilt + @echo "Running JSHint on javascript... ${CHECK}" # # RUN JSHINT & QUNIT TESTS IN PHANTOMJS # @@ -53,6 +57,7 @@ test: # clean: + -rm js/.lastbuilt -rm -r bootstrap # @@ -121,4 +126,4 @@ watch: watchr -e "watch('less/.*\.less') { system 'make' }" -.PHONY: build test clean bootstrap bootstrap-js bootstrap-css bootstrap-fonts gh-pages watch +.PHONY: build test clean bootstrap bootstrap-js bootstrap-css bootstrap-fonts gh-pages watch splash -- GitLab From 4cf44bdea50bb246ee57e85021d552bd019b11b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Fri, 1 Mar 2013 16:35:14 +0100 Subject: [PATCH 10/13] Only run recess if less files have changed --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3526cf1b64..3e933ec9cf 100644 --- a/Makefile +++ b/Makefile @@ -12,9 +12,7 @@ UGLIFYJS_BIN=$(BIN_PREFIX)uglifyjs # BUILD DOCS # - @$(RECESS_BIN) --compile ${BOOTSTRAP_LESS} > ${BOOTSTRAP} - @echo "Compiling LESS with Recess... ${CHECK}" -build: splash js/.lastbuilt +build: splash js/.lastbuilt ${BOOTSTRAP} @cp fonts/* docs/assets/fonts/ @cp js/*.js docs/assets/js/ @cp js/tests/vendor/jquery.js docs/assets/js/ @@ -40,6 +38,10 @@ js/.lastbuilt: js/*.js @$(JSHINT_BIN) js/tests/unit/*.js --config js/.jshintrc @touch js/.lastbuilt @echo "Running JSHint on javascript... ${CHECK}" + +${BOOTSTRAP}: ${BOOTSTRAP_LESS} + @$(RECESS_BIN) --compile $^ > $@ + @echo "Compiling LESS with Recess... ${CHECK}" # # RUN JSHINT & QUNIT TESTS IN PHANTOMJS # -- GitLab From f7b8c43d59b53cfb29c68d7b19b35ae26779371d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Fri, 1 Mar 2013 17:12:02 +0100 Subject: [PATCH 11/13] Only copy js and font files if they have changed --- Makefile | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 3e933ec9cf..a0afe99d09 100644 --- a/Makefile +++ b/Makefile @@ -12,21 +12,29 @@ UGLIFYJS_BIN=$(BIN_PREFIX)uglifyjs # BUILD DOCS # -build: splash js/.lastbuilt ${BOOTSTRAP} - @cp fonts/* docs/assets/fonts/ - @cp js/*.js docs/assets/js/ - @cp js/tests/vendor/jquery.js docs/assets/js/ - @echo "Prepping fonts and JavaScript... ${CHECK}" - @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 +FONTS=${wildcard fonts/*} +DOCS_FONTS=${patsubst fonts/%,docs/assets/fonts/%,${FONTS}} +JS=${wildcard js/*.js} js/tests/vendor/jquery.js +DOCS_JS=${patsubst js/%,docs/assets/js/%,${wildcard js/*.js}} docs/assets/js/jquery.js + +build: splash js/.lastbuilt ${BOOTSTRAP} ${DOCS_FONTS} ${DOCS_JS} docs/assets/js/bootstrap.js docs/assets/js/bootstrap.min.js + @echo "${HR}" + @echo "\033[36mSuccess!\n\033[39m" + @echo "\033[37mThanks for using Bootstrap," + @echo "<3 @mdo and @fat\n\033[39m" + +docs/assets/js/bootstrap.js docs/assets/js/bootstrap.min.js: ${JS} + @cat ${JS} > docs/assets/js/bootstrap.js @$(UGLIFYJS_BIN) -nc docs/assets/js/bootstrap.js > docs/assets/js/bootstrap.min.tmp.js @echo "/**\n* Bootstrap.js v3.0.0 by @fat & @mdo\n* Copyright 2012 Twitter, Inc.\n* http://www.apache.org/licenses/LICENSE-2.0.txt\n*/" > docs/assets/js/copyright.js @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}" - @echo "${HR}" - @echo "\033[36mSuccess!\n\033[39m" - @echo "\033[37mThanks for using Bootstrap," - @echo "<3 @mdo and @fat\n\033[39m" + +${DOCS_FONTS} ${DOCS_JS}: ${FONTS} ${JS} + @cp ${FONTS} docs/assets/fonts/ + @cp ${JS} docs/assets/js/ + @echo "Prepping fonts and JavaScript... ${CHECK}" splash: @echo "\n\n" -- GitLab From 79120e14b149c9373ac50e3b5f8aa5b12514a959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Fri, 1 Mar 2013 17:19:07 +0100 Subject: [PATCH 12/13] make clean should clean all files --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index a0afe99d09..94729cde0a 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,10 @@ test: # clean: + -rm ${BOOTSTRAP} -rm js/.lastbuilt + -rm ${DOCS_FONTS} + -rm ${DOCS_JS} -rm -r bootstrap # -- GitLab From f0594fd024e4cfb60b494e94818eef1d7e27b07a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se> Date: Fri, 1 Mar 2013 17:27:54 +0100 Subject: [PATCH 13/13] Simplify building of bootstrap/js/*.js --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 94729cde0a..0f6bbfb26e 100644 --- a/Makefile +++ b/Makefile @@ -88,7 +88,7 @@ bootstrap-js: bootstrap/js/*.js bootstrap/js/*.js: js/*.js mkdir -p bootstrap/js - 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 + cat $^ > bootstrap/js/bootstrap.js $(UGLIFYJS_BIN) -nc bootstrap/js/bootstrap.js > bootstrap/js/bootstrap.min.tmp.js 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 cat bootstrap/js/copyright.js bootstrap/js/bootstrap.min.tmp.js > bootstrap/js/bootstrap.min.js -- GitLab