How to Use Grunt in Magento 2

Grunt is a contemporany JavaScrip task runner. The purpose of Grunt is to simplifies repetitive tasks by automating linting, compilation, minification, or uni testing. You only have to configure a task runner throught a Gruntfile. This tool can easily be utilized within all possible platforms and projects.
Althrought Magento 2 introduces built-in Grunt tasks, there are still several steps that have to be passed.Install NodeJs in your 

PC  npm install -g grunt-cli – (Install Grunt CLI tool globally)

npm install – (Install the node.js project dependency)

php bin/magento cache:clean – (Remove Cache)

grunt clean – (Clean theme by command)

CMD command prompt with administrator privilege

grunt exec:yourthemename
grunt less:yourthemename

grunt watchVideo Tutorial - Watch the Video Tutorial HERE If grunt watch or the runner from Php Storm doesn’t work you have to start again with these commands:
php bin/magento cache:clean – (Remove Cache)


grunt clean – (Clean theme by command)
CMD command prompt with administrator privilege


grunt exec:yourthemename
grunt less:yourthemename
grunt watch

http://joshuasoileau.com/articles/2016/06/08/how-to-use-grunt-in-magento-2.html

https://firebearstudio.com/blog/magento-2-grunt.html

How to create a custom Grunt task in Magento 2
https://inchoo.net/magento-2/how-to-create-a-custom-grunt-task-in-magento-2/

Scroll to Top