Installing Grunt
Follow these steps and you should be ready to go:
- Download and install Node, which we use to manage our dependencies.
- Install the Grunt command line tools,
grunt-cli
, withnpm install -g grunt-cli
. - Navigate to the root
/starter
directory and runnpm install
to install our local dependencies listed in package.json.
When completed, you’ll be able to run the various Grunt commands provided from the command line.
Using Grunt
Our Gruntfile includes the following commands and tasks:
Task | Description |
grunt serve |
Running a server and start watching for change on css. scss and js files to compile and minify them. It also watch on html files, every change made in the files is reflected automatically in real time to the browser. |
grunt build |
Create a dist folder, copy all files inside it except scss and grunt files |
grunt watch |
Only start watching for change on css and js files to compile and minify them. |
grunt sass |
Compile /assets/css/style.scss file to style.css and style.min.css |
grunt js |
Minify /assets/js/script.js to script.min.js |
Troubleshooting
Should you encounter problems with installing dependencies or running Grunt commands, uninstall all previous dependency versions (global and local). Then, rerun npm install
.