【问题标题】:Launch grunt from outside directory从外部目录启动 grunt
【发布时间】:2014-08-04 17:27:00
【问题描述】:

是否可以通过终端启动 grunt 任务而不进入我的工作文件夹?

我问这个是因为我试图自动化 grunt 命令,但我的终端命令将从我的个人文件夹中执行。

我尝试了这些但没有成功:

weyland$ /Applications/MAMP/htdocs/test/app/js/grunt
No such file or directory


cd /Applications/MAMP/htdocs/test/app/js/ & grunt
Fatal error: Unable to find local grunt.

【问题讨论】:

    标签: javascript terminal gruntjs command-line-interface


    【解决方案1】:

    你可以设置两个参数--base--gruntfile

    所以,你可以调用watch任务,例如:

    grunt --base your_path --gruntfile your_app_path/GruntFile.js watch 
    

    如果你调用 grunt --help:

    --base 指定备用基本路径。默认情况下,所有文件路径都是相对于 Gruntfile 的。 (grunt.file.setBase) *

    --gruntfile 指定一个备用 Gruntfile。默认情况下,grunt 在当前目录或父目录中查找最近的 Gruntfile.js 或 Gruntfile.coffee 文件。

    希望对你有帮助。

    问候。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-13
      相关资源
      最近更新 更多