Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grunt: what is the purpose of cwd?

Tags:

gruntjs

I know cwd stands for "current working directory", but what I don't understand is why is has to be included in the gruntfile.js.

Won't the script run always in the current working directory? Why would you need to change or specify another one?

like image 804
MauF Avatar asked Jul 27 '16 23:07

MauF


People also ask

What is grunt used for?

Grunt is a JavaScript task runner, a tool used to automatically perform frequent tasks such as minification, compilation, unit testing, and linting. It uses a command-line interface to run custom tasks defined in a file (known as a Gruntfile). Grunt was created by Ben Alman and is written in Node. js.

Is grunt still used?

So task runners like Grunt and Gulp still have their place and we still use both here at Delicious Brains as build tools for different products we develop.

What is grunt config?

config. Access project-specific configuration data defined in the Gruntfile . Note that any method marked with a ☃ (unicode snowman) is also available directly on the grunt object, and any method marked with a ☆ (white star) is also available inside tasks on the this object. Just so you know.


1 Answers

grunt.js resides in the root of our project.

cwd is the path where grunt looks for the files matching the pattern in src and performs operations on. It can be an img folder in the current project root or a script folder in the current project root.

In other words, cwd is the parent folder of src files. It might not the root folder of the root of the current project but a child of it.

Hope this helps answer your question.

like image 185
sonali Avatar answered Oct 21 '22 08:10

sonali