Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@AshKyd 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