What is Grunt in Magento2? Why use grunt. I want to know detail about Grunt. When we can use Grunt.


2 Answers 2


What is Grunt in Magento2?

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).

Why use grunt?

Useing of Grunt to automate any tasks you need, but out of the box Magento comes with pre-configured grunt tasks for compiling LESS files.

And also Grunt definition is determine why we use Grunt, you can see above details.

For more detail & documentation check below link

I hope it helps!


In one word: automation.

Grunt is a tool which uses for compile less(.less) file into css(.css) file which are include in <head> section.

In Magento2 you can configure your custom theme as per this doc: How to configure Grunt in Magento2 ? and Compile less using grunt in Magento2 ?

After successful configured grunt, whenever you change in .less files in your theme, it'll automatically generates .css files and you can see your changes at storefront.

Know more about grunt here: Gruntjs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.