简体   繁体   中英

How to add grunt to my project?

I am new to grunt, I am not able to understand initial setup. What I have done all is installed node and grunt and this is no where related to my project. My question is 1. how to add grunt to my project. I am using angular project. Do I have to add grunt inside my project folder? if yes, Where should I add and how should I add? 2. Many of the document says to update gruntfile.js. When I search I can see so many gruntfile.js inside grunt\\node_modules folder. Which gruntfile.js file I should modify?

Grunt doesn't actually go into your angular project. Only libraries that are meant to show up in your client's browser (ie to actually run the webapp) should be injected into Angular.

Think of grunt as a tool to help you manage the build system outside of your angular project.

You could run npm install grunt --save-dev and it would create a package.json file with information regarding your dependencies.

www.egghead.io has some great resources on learning Grunt and Angular, as does http://build-podcast.com/ .

Consider also looking into npm , gulp , webpack and other alternatives.

  1. Step1 - Install node and npm
  2. Step2 - npm install -g grunt-cli
  3. Step3 - Create Gruntfile.js in your project root folder. Click here for sample file
  4. Step4 - register a task
  5. Step5 - Run Grunt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM