What is Grunt in Magento2? Why use grunt. I want to know detail about Grunt. When we can use Grunt.
-
Possible duplicate of Difference between static content deploy & grunt exec– AndrewCommented Nov 21, 2018 at 5:35
-
To check more on how to use Grunt and what is grunt on Magento 2. Please read our blog here. Hope this will help you..!– ZealousWebCommented Jul 26, 2021 at 12:54
2 Answers
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