Magento2: Using Grunt
Magento is reading files from pub/static folder, but you are developing your theme under app/design/frontend, that means each time you want to make change in css file, you need to copy changed file to pub/static folder. This can be automated with grunt.
Grunt is javascript task runner. So it can copy, minimize, less, etc…. your files.
Installation
This is installation for centOS, it may different for other servers.
We need nodejs first, then npm (node package manager)
yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -
yum install nodejs
Now to your local folder:
npm install grunt
npm install -g grunt-cli
Then which grunt plugins you want to use:
npm install grunt-contrib-copy --save-dev
npm install grunt-contrib-watch --save-dev
Using Grunt
Now create GruntFile.js
in your folder with content below. This example will copy local-l.css
file from app/design
to pub/static
each time you make change in app/design
.