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?
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With