开发者

run compass watch terminal command upon opening the folder with textmate

I use textmate for website development and compass to compile css stylesheets. Right now everytime I open up the folder with textmate I have to additionally run a compass watch /path/to/folder command. I know textmate is pretty powerfull, but not sure how to make it work so the compass watch command is automatically applied to projects you open with textmate (I usually drag the projectfo开发者_高级运维lder on the dock-icon). Is this possible?


Sure thing. You will need to make a small function in your .bashrc file.

I based the function below off an alias I create for SublimeText2 to make it work like "mate dir/" (a feature I missed greatly):

#Sublime Text Alias
alias slime='open -a "/Applications/Sublime Text 2.app"'

So, you don't really want an alias to run two commands, since an alias is...an "alias" for a specific command. However, a function is well suited:

#for Textmate
function matew() {
    open -a "/Applications/TextMate.app" $1
    compass watch $1
}

I picked "matew" - cause it was like mate+watch, but you can call your function whatever you will remember. (e.g epicPwn(), etc) Thus, your new function is run as:

matew dirName/

Note: Just be sure to put the correct path to TextMate. Also, the compass watch command will fowl up if you aren't passing a directory, obviously. Similarly if the directory doesn't have a compass project -> compass watch will spit back a standard "no project" error (but TM will still open the dir/). e.g.:

matew src/
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜