Magento 2: Grunt

Grunt is the JavaScript Task Runner. The less work you have to do when performing repetitive tasks like minification, compilation, unit testing, linting, etc, the easier your job becomes.

Installing and configuring Grunt

Install Node.js to the system

npm install -g grunt-cli

in Magento Root folder

rename : package.json.sample -> package.json
rename : Gruntfile.js.sample -> Gruntfile.js

cd
npm install grunt –save-dev
npm install
npm update
{npm install grunt-contrib-less} spacail case

php bin/magento cache:clean
grunt clean

grunt exec:
grunt less:
grunt watch

dev/tools/grunt/configs/theme.js

module.exports = { : {
area: ‘frontend’,
name: ‘/‘,
locale: ‘‘,
files: [
‘, //path to root source file

],
dsl: ‘less’
},

example

luma2: { // your nem theme name
area: ‘frontend’,
name: ‘Vendor/luma2’, //theme path
locate: ‘en_US’,
files: [
‘css/styles-m’,
‘css/styles-1’
],
dsl: ‘less’
},