Romain Braun
Romain Braun

Reputation: 3684

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.

Upvotes: 0

Views: 495

Answers (1)

Mario Araque
Mario Araque

Reputation: 4572

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.

Upvotes: 1

Related Questions