How do I run grunt from a different folder than my root project

╄→尐↘猪︶ㄣ 提交于 2019-12-02 23:27:31

You can set two parameters --base and --gruntfile

From grunt --help:

--base Specify an alternate base path. By default, all file paths are relative to the Gruntfile. (grunt.file.setBase) *

--gruntfile Specify an alternate Gruntfile. By default, grunt looks in the current or parent directories for the nearest Gruntfile.js or Gruntfile.coffee file.

So, you can execute:

grunt --base c\my_app --gruntfile c\my_app\GruntFile.js mytask

Since grunt 1.3 you can omit --gruntfile.

So, instead of

grunt --base c\my_app --gruntfile c\my_app\GruntFile.js mytask

you can just

grunt --base c\my_app mytask (and --base can be replaced with -b)

I'll advise you to run it from your app directory because the modules are installed into nodes_modules, etc. you must move to your app directory and run grunt:

cd f:
cd  a\c\my_app
grunt {yourTasks}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!