Javascript 从外部目录启动grunt
是否可以通过终端启动grunt任务而不在我的工作文件夹中 我这样问是因为我正在尝试自动执行grunt命令,但是我的终端命令将从我的个人文件夹中执行 我尝试了这些,但没有成功:Javascript 从外部目录启动grunt,javascript,terminal,gruntjs,command-line-interface,Javascript,Terminal,Gruntjs,Command Line Interface,是否可以通过终端启动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
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
指定备用的基本路径。默认情况下,所有文件路径都是相对于GrunFile的。(grunt.file.setBase)*
--gruntfile
指定备用gruntfile。默认情况下,grunt在当前或父目录中查找最近的Gruntfile.js或Gruntfile.coffee文件
希望能有帮助
问候