从外部目录启动grunt

Launch grunt from outside directory

本文关键字:grunt 启动 从外部      更新时间:2023-09-26

是否可以通过终端启动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.

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

所以,你可以调用watch task,例如:

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

如果你调用grunt——help:

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

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

希望有帮助。

问候。