bootstrap.sh 963 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh
  2. echo "This script clones Twitter Bootstrap, compiles it with lessc and lessphp,"
  3. echo "cleans up results with sort.php, and outputs diff. To run it, you need to"
  4. echo "have git and lessc installed."
  5. echo ""
  6. if [ -z "$input" ]; then
  7. input="bootstrap/less/bootstrap.less"
  8. fi
  9. dest=$(basename "$input")
  10. dest="${dest%.*}"
  11. if [ -z "$@" ]; then
  12. diff_tool="diff -b -u -t -B"
  13. else
  14. diff_tool=$@
  15. fi
  16. mkdir -p tmp
  17. if [ ! -d 'bootstrap/' ]; then
  18. echo ">> Cloning bootstrap to bootstrap/"
  19. git clone https://github.com/twitter/bootstrap
  20. fi
  21. echo ">> lessc compilation ($input)"
  22. lessc "$input" "tmp/$dest.lessc.css"
  23. echo ">> lessphp compilation ($input)"
  24. ../plessc "$input" "tmp/$dest.lessphp.css"
  25. echo ">> Cleanup and convert"
  26. php sort.php "tmp/$dest.lessc.css" > "tmp/$dest.lessc.clean.css"
  27. php sort.php "tmp/$dest.lessphp.css" > "tmp/$dest.lessphp.clean.css"
  28. echo ">> Doing diff"
  29. $diff_tool "tmp/$dest.lessc.clean.css" "tmp/$dest.lessphp.clean.css"