使用 textmate 打开文件夹后运行 compass watch 终端命令

发布于 2024-10-19 04:36:33 字数 238 浏览 0 评论 0原文

我使用 textmate 进行网站开发,使用 compass 编译 css 样式表。现在,每次我用 textmate 打开文件夹时,我都必须另外运行 compass watch /path/to/folder 命令。我知道 textmate 非常强大,但不知道如何使其工作,因此 compass watch 命令会自动应用于您使用 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 projectfolder on the dock-icon). Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏末染殇 2024-10-26 04:36:33

当然可以。您需要在 .bashrc 文件中创建一个小函数。

我基于为 SublimeText2 创建的别名来构建下面的函数,使其像“mate dir/”一样工作(我非常错过的​​一个功能):

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

所以,你并不真的希望一个别名运行两个命令,因为别名是...特定命令的“别名”。然而,函数非常适合:

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

我选择了“matew” - 因为它就像 mate+watch,但您可以根据自己的记忆调用函数。 (例如epicPwn()等)因此,您的新函数将运行为:

matew dirName/

注意:请务必输入 TextMate 的正确路径。另外,如果您没有传递目录,显然compass watch 命令将会跟踪。同样,如果该目录没有指南针项目 -> compass watch 将返回一个标准的“无项目”错误(但 TM 仍会打开 dir/)。例如:

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.

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文