Skip to content

Instantly share code, notes, and snippets.

@garrows
Created July 10, 2015 05:50
Show Gist options
  • Save garrows/f8cecc8fe68713d77338 to your computer and use it in GitHub Desktop.
Save garrows/f8cecc8fe68713d77338 to your computer and use it in GitHub Desktop.
Js-Beautify recursively git hook
#!/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 {} \;
@AshKyd
Copy link

AshKyd commented Dec 2, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment