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. scssand jsfiles to compile and minify them. It also watch on htmlfiles, every change made in the files is reflected automatically in real time to the browser. |
grunt build
|
Create a distfolder, copy all files inside it except scss and grunt files |
grunt watch
|
Only start watching for change on cssand jsfiles to compile and minify them. |
grunt sass
|
Compile /assets/css/style.scss file to style.cssand 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
.