Installation of the Angularjs--grunt artifact

Source: Internet
Author: User

Objective:

Just began to learn AngularJS, in Mu class online watching the desert teacher's video (http://www.imooc.com/learn/156), inside just began to tell the front-end development-debugging-testing tools and tool used, I also smattering the front-end development, It seems that the desert teacher after class, only to find that I used to develop the time of day by a project to drag a long time originally because I did not find a good way. In this, hope to see this blog's friends can go to see this video, especially for halfway decent's friends, played a big role.

Good gossip less said, just also to MU class online shop played ads, this section is mainly said to help group we deal with some additional tasks (compression, merger, compilation, unit testing, etc.) artifact Grunt.

It seems that the official documents I found to say are very clear, let's first go over how to build a Grunt:

    1. Create a new file on the desktop, named Grunt.
    2. Create two files in the grunt file

Package.json (will install the established repository)

Example:

{  "name": "gruntjs.cn",  "version": "0.1.0",  "Devdependencies": {     "Grunt": "~0.4.2",    "Grunt-contrib-jshint": "~0.6.3",    "Grunt-contrib-nodeunit": "~ 0.2.0 ",    " grunt-contrib-uglify ":" ~0.2.2 "  }}

Gruntfile.js (for configuring or defining tasks, loading the grunt plugin)

Example

 //  wrapper function  Module.exports = function   (Grunt) { //  Task configuration   Grunt.initconfig ({Pkg:grunt.file.readJSON ( ' Package.json ' ), uglify: {build: {src:  ' src/<%= pkg.name%>.js '  //  Task load  grunt.loadnpmtasks ('  Grunt-contrib-uglify ' );  //  custom task  Grunt.registertask (' Default ', [' uglify '  

Specific code meaning, please turn to Grunt website to browse

3, assuming you have node. js, we need the node. JS Package Manager (NPM) to download what we need, and then we open the command-line tool and go to the root directory

Run NPM install to start downloading the plugins we need

After the download is complete, we can see that our root directory grunt has one more file Node-modules

  

Node-modules inside is the plugin we need

  

Grunt-contrib-uglify is the plugin we need to compress files

Grunt-contrib-jshit Detection JS Syntax

Grunt-contrib-nodeunit the test file

Of course, we have other plug-ins, in this is not one by one repeat, the heart of the Tao friends please go to Grunt official website to see, so far, all the installation work is over, the next section began to tell how to use.

Installation of the Angularjs--grunt artifact

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.