Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
  1. Open your project folder in the terminal or command prompt.
  2. Type npm init and press enter.
  3. Create a package name, version, description, main file, etc. as prompted.
  4. Set the entry point to index.js or the main file you are using for your project.
  5. Once the package is created, type npm install --save-dev grunt and press enter.
  6. Type npm install --save-dev grunt-contrib-watch to install the watch task.
  7. Type npm install --save-dev grunt-contrib-concat to install the concat task.
  8. Type npm install --save-dev grunt-contrib-uglify to install the uglify task.
  9. Type npm install --save-dev grunt-contrib-sass to install the sass task.
  10. After installing all the necessary tasks, add the following code to the package.json file:
"devDependencies": {
  "grunt": "^1.4.1",
  "grunt-contrib-watch": "^1.1.0",
  "grunt-contrib-concat": "^2.0.0",
  "grunt-contrib-uglify": "^5.0.1",
  "grunt-contrib-sass": "^3.1.0"
}
  1. Save the package.json file and run the command npm install in the terminal or command prompt to install all the dependencies.
  2. Once the installation is complete, you can use grunt tasks in your project.