Created
July 10, 2015 05:50
-
-
Save garrows/f8cecc8fe68713d77338 to your computer and use it in GitHub Desktop.
Js-Beautify recursively git hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
type js-beautify >/dev/null 2>&1 || { echo >&2 "js-beautify command missing. Installing now."; sudo npm install -g js-beautify; } | |
find . -type f -name "*.js" -not -path "*node_modules*" -exec js-beautify -r {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have xargs on your system, you can use the following multi-process version (where
-P4
equals 4 threads):find src/ test/ -type f -name "*.js" -not -path "*node_modules*"| xargs -P4 js-beautify -r