Using GruntJS to build the installation of Web applications
- 2020-03-30 03:11:37
- OfStack
It has the following functions
Merge JS files
Compressed JS file
Unit testing (based on QUnit)
In a word: automation
Here's how to install it.
Install node
Refer to the nodejs primer (the latest node will automatically install NPM)
Install the grunt command line tool grunt-cli
Use the -g global installation so you can use it in any directory. Command: NPM install -g grunt-cli
< img border = 0 id = theimg onclick = window. The open this. (SRC) SRC = "/ / files.jb51.net/file_images/article/201406/20146494531738.png? 20145494542 ">
It is important to note that in Linux or MAC sometimes will report no permissions error, in this case must be preceded by a sudo,
< img border = 0 id = theimg onclick = window. The open this. (SRC) SRC = "/ / files.jb51.net/file_images/article/201406/20146494558291.png? 20145494610 ">
After installation, you can view the version of the change tool. Command: grunt -version
< img border = 0 id = theimg onclick = window. The open this. (SRC) SRC = "/ / files.jb51.net/file_images/article/201406/20146494628166.png? 20145494638 ">
Install grunt and its plug-ins
Go to the root directory of a project and use the command NPM install grunt --save-dev
< img border = 0 id = theimg onclick = window. The open this. (SRC) SRC = "/ / files.jb51.net/file_images/article/201406/20146494709437.png? 20145494724 ">
< img border = 0 id = theimg onclick = window. The open this. (SRC) SRC = "/ / files.jb51.net/file_images/article/201406/20146494742159.png? 20145494754 ">
At this point, a review of the grunt version adds a 4.0, as shown below
< img border = 0 id = theimg onclick = window. The open this. (SRC) SRC = "/ / files.jb51.net/file_images/article/201406/20146494812909.png? 20145494821 ">