-
-
Save mingtsay/1917241d90a63fa1a29f109faa9e707d to your computer and use it in GitHub Desktop.
Adds node_modules/.bin to the PATH (zsh)
This file contains hidden or 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
if ((!$+commands[npm])); then | |
return 1 | |
fi | |
# Adds node_modules/.bin to the PATH | |
npm_bin_hook() { | |
if [ -n "${OLDPATH+x}" ]; then | |
PATH=$OLDPATH | |
unset OLDPATH | |
fi | |
if [ -f package.json ]; then | |
OLDPATH=$PATH | |
PATH=$PWD/node_modules/.bin:$PATH | |
fi | |
} | |
add-zsh-hook chpwd npm_bin_hook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment