Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added plugin for BEM #1325

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 33 additions & 0 deletions plugins/bem/bem.plugin.zsh
@@ -0,0 +1,33 @@
# Completion for bem command
# Автодополнение для команды bem
eval "$(bem completion 2> /dev/null)"

# If we have bem in our project run them, otherwise run global bem
# Если у нас есть установленный bem в папке с проектом, то запустим его
# иначе - глобальный bem
whichBem() {
bemPath="$1/node_modules/.bin/bem"
if [ -f ${bemPath} ]
then
echo ${bemPath}
else
if [ $1='/' ]
then
echo $(which bem)
else
parent=$(dirname $1)

echo $(whichBem $parent)
fi
fi
}

bem() {
bemCmd=$(whichBem $PWD)
if [ -f ${bemCmd} ]
then
bemCmd="${bemCmd} $@"
eval ${bemCmd}
fi
}