1
0

Makefile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. DATE=$(shell date +%I:%M%p)
  6. CHECK=\033[32m✔\033[39m
  7. HR=\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
  8. #
  9. # BUILD DOCS
  10. #
  11. build:
  12. @echo "\n${HR}"
  13. @echo "Building Bootstrap..."
  14. @echo "${HR}\n"
  15. @./node_modules/.bin/jshint js/*.js --config js/.jshintrc
  16. @./node_modules/.bin/jshint js/tests/unit/*.js --config js/.jshintrc
  17. @echo "Running JSHint on javascript... ${CHECK} Done"
  18. @./node_modules/.bin/recess --compile ${BOOTSTRAP_LESS} > ${BOOTSTRAP}
  19. @./node_modules/.bin/recess --compile ${BOOTSTRAP_RESPONSIVE_LESS} > ${BOOTSTRAP_RESPONSIVE}
  20. @echo "Compiling LESS with Recess... ${CHECK} Done"
  21. @node docs/build
  22. @cp img/* docs/assets/img/
  23. @cp js/*.js docs/assets/js/
  24. @cp js/tests/vendor/jquery.js docs/assets/js/
  25. @echo "Compiling documentation... ${CHECK} Done"
  26. @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
  27. @./node_modules/.bin/uglifyjs -nc docs/assets/js/bootstrap.js > docs/assets/js/bootstrap.min.tmp.js
  28. @echo "/**\n* Bootstrap.js v2.3.2 by @fat & @mdo\n* Copyright 2013 Twitter, Inc.\n* http://www.apache.org/licenses/LICENSE-2.0.txt\n*/" > docs/assets/js/copyright.js
  29. @cat docs/assets/js/copyright.js docs/assets/js/bootstrap.min.tmp.js > docs/assets/js/bootstrap.min.js
  30. @rm docs/assets/js/copyright.js docs/assets/js/bootstrap.min.tmp.js
  31. @echo "Compiling and minifying javascript... ${CHECK} Done"
  32. @echo "\n${HR}"
  33. @echo "Bootstrap successfully built at ${DATE}."
  34. @echo "${HR}\n"
  35. @echo "Thanks for using Bootstrap,"
  36. @echo "<3 @mdo and @fat\n"
  37. #
  38. # RUN JSHINT & QUNIT TESTS IN PHANTOMJS
  39. #
  40. test:
  41. ./node_modules/.bin/jshint js/*.js --config js/.jshintrc
  42. ./node_modules/.bin/jshint js/tests/unit/*.js --config js/.jshintrc
  43. node js/tests/server.js &
  44. phantomjs js/tests/phantom.js "http://localhost:3000/js/tests"
  45. kill -9 `cat js/tests/pid.txt`
  46. rm js/tests/pid.txt
  47. #
  48. # CLEANS THE ROOT DIRECTORY OF PRIOR BUILDS
  49. #
  50. clean:
  51. rm -r bootstrap
  52. #
  53. # BUILD SIMPLE BOOTSTRAP DIRECTORY
  54. # recess & uglifyjs are required
  55. #
  56. bootstrap: bootstrap-img bootstrap-css bootstrap-js
  57. #
  58. # JS COMPILE
  59. #
  60. bootstrap-js: bootstrap/js/*.js
  61. bootstrap/js/*.js: js/*.js
  62. mkdir -p bootstrap/js
  63. 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
  64. ./node_modules/.bin/uglifyjs -nc bootstrap/js/bootstrap.js > bootstrap/js/bootstrap.min.tmp.js
  65. echo "/*!\n* Bootstrap.js by @fat & @mdo\n* Copyright 2013 Twitter, Inc.\n* http://www.apache.org/licenses/LICENSE-2.0.txt\n*/" > bootstrap/js/copyright.js
  66. cat bootstrap/js/copyright.js bootstrap/js/bootstrap.min.tmp.js > bootstrap/js/bootstrap.min.js
  67. rm bootstrap/js/copyright.js bootstrap/js/bootstrap.min.tmp.js
  68. #
  69. # CSS COMPLILE
  70. #
  71. bootstrap-css: bootstrap/css/*.css
  72. bootstrap/css/*.css: less/*.less
  73. mkdir -p bootstrap/css
  74. ./node_modules/.bin/recess --compile ${BOOTSTRAP_LESS} > bootstrap/css/bootstrap.css
  75. ./node_modules/.bin/recess --compress ${BOOTSTRAP_LESS} > bootstrap/css/bootstrap.min.css
  76. ./node_modules/.bin/recess --compile ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.css
  77. ./node_modules/.bin/recess --compress ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.min.css
  78. #
  79. # IMAGES
  80. #
  81. bootstrap-img: bootstrap/img/*
  82. bootstrap/img/*: img/*
  83. mkdir -p bootstrap/img
  84. cp img/* bootstrap/img/
  85. #
  86. # MAKE FOR GH-PAGES 4 FAT & MDO ONLY (O_O )
  87. #
  88. gh-pages: bootstrap docs
  89. rm -f docs/assets/bootstrap.zip
  90. zip -r docs/assets/bootstrap.zip bootstrap
  91. rm -r bootstrap
  92. rm -f ../bootstrap-gh-pages/assets/bootstrap.zip
  93. node docs/build production
  94. cp -r docs/* ../bootstrap-gh-pages
  95. #
  96. # WATCH LESS FILES
  97. #
  98. watch:
  99. echo "Watching less files..."; \
  100. watchr -e "watch('less/.*\.less') { system 'make' }"
  101. .PHONY: docs watch gh-pages bootstrap-img bootstrap-css bootstrap-js