Do you know what a grunt is?

Source: Internet
Author: User
Tags install node

In a word, grunt is the Mavan of the front. It is the building tool of the JavaScript world.

1. First install node. js, because grunt relies on the npm of node. js to manage and install. The final sign of the successful installation of node. JS is: Enter it under the DOS command of CMD:

Node-v   npm-v   //When installing node. js, the system automatically joins the command NPM into the system variable, so it can be entered in the console.

2. On the DOS interface, install grunt with the command. A module of grunt is the equivalent of a tool, and grunt is a toolkit that is assembled from a variety of tools.

NPM install-g grunt-cli  //-g represents a global installation, Grunt is a server-side version, and GRUNT-CLI is the client version.

Node Package Manager, NPM

Although the above command is executed, installing GRUNT-CLI does not mean that grunt is installed. (Under DOS interface, CTRL + C exits the current command environment)

Similarly, the command to install each module: "NPM Install module name--save-dev"

NPM Install <module>--save-dev  //commands for installing individual modules

4. After completing the above two steps, you can grunt the project in combat.

We know that there are pom.xml configuration files in Maven to configure project information. The same create grunt project must have two files, Package.json files, and gruntfile.js files.

Package.json: Used to save project metadata. Gruntfile.js: Used to configure or define tasks, load Grunt plug-ins.

The configuration details of the Package.json are as follows:

{
"Name": "Qmcaifu",
"Version": "1.0.1",
"description": "The Web page for HTML5",
"Main": "Index.js",
"Scripts": {
"Test": "Echo \" Error:no test specified\ "&& exit 1"
},
"Author": "Zhao, Xu-guang",
"License": "ISC"
}

After completing the Package.json and gruntfile.js two configuration files, enter the command:

Then the task in installing the Grunt cli,grunt CLI is to run the Grunt version specified by Gruntfile. This allows you to install multiple grunt versions on a single computer.

Reference blog:

1. Http://www.gruntjs.net/getting-started#cli

Do you know what a grunt is?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.