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

前端 未结 3 629
礼貌的吻别
礼貌的吻别 2021-02-03 20:15

Is there a way to tell grunt which grunt.js file to use?

I have an f:\\a\\b\\tools folder that contains grunt.cmd, node.exe,..., my actual web

3条回答
  •  南方客
    南方客 (楼主)
    2021-02-03 20:59

    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
    

提交回复
热议问题