【问题标题】:run compass watch terminal command upon opening the folder with textmate使用 textmate 打开文件夹时运行 compass watch 终端命令
【发布时间】:2011-07-26 07:00:27
【问题描述】:

我使用 textmate 进行网站开发,并使用 compass 编译 css 样式表。现在,每次我用 textmate 打开文件夹时,我都必须另外运行 compass watch /path/to/folder 命令。我知道 textmate 非常强大,但不确定如何使其工作,因此compass watch 命令会自动应用于您使用 textmate 打开的项目(我通常将项目文件夹拖到停靠图标上)。这可能吗?

【问题讨论】:

    标签: command textmate compass-sass


    【解决方案1】:

    当然。您需要在 .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.
    

    【讨论】:

    • 作为一个仅供参考,至少在 Sublime Text 2 中,有一个名为 subl 的命令行二进制文件。类似于 TextMate 的伙伴。
    猜你喜欢
    • 1970-01-01
    • 2013-04-14
    • 1970-01-01
    • 2014-12-10
    • 2011-02-04
    • 1970-01-01
    • 1970-01-01
    • 2020-06-28
    • 1970-01-01
    相关资源
    最近更新 更多