Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added plugin for BEM #1325

Closed
wants to merge 1 commit into from

2 participants

@corpix

BEM is a methodology for building big web applications link
My plugin enables autocompletion for console bem tool and "local executable" detection.
For example if $PWD/node_modules/.bin/bem exists it will run them instead of running globally installed bem to support different bem tools versions.

@zxqfox

+1

@corpix

I have found some bugs, so closing for now.
Can't figure out how to enable autocompletion for function

@corpix corpix closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 25, 2012
  1. @corpix

    Added plugin for BEM

    corpix authored
This page is out of date. Refresh to see the latest.
Showing with 33 additions and 0 deletions.
  1. +33 −0 plugins/bem/bem.plugin.zsh
View
33 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
+}
+
Something went wrong with that request. Please try again.