Created
November 27, 2012 01:17
-
-
Save puffnfresh/4151775 to your computer and use it in GitHub Desktop.
Adds node_modules/.bin to the PATH (zsh)
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
# Adds node_modules/.bin to the PATH | |
npm_chpwd_hook() { | |
if [ -n "${PRENPMPATH+x}" ]; then | |
PATH=$PRENPMPATH | |
unset PRENPMPATH | |
fi | |
if [ -f package.json ]; then | |
PRENPMPATH=$PATH | |
PATH=$(npm bin):$PATH | |
fi | |
} | |
add-zsh-hook preexec npm_chpwd_hook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment