简体   繁体   中英

Launch grunt from outside directory

Is it possible to start a grunt task via the terminal without being in my working folder ?

I'm asking this because I'm trying to automate the grunt command, but my terminal command will be executed from my personal folder.

I tried these but without success :

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.

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

So, you can call watch task, for example:

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

If you call 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.

Hope it helps.

Regards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM