Window Installation Grunt method diagram

Source: Internet
Author: User
Tags install node
1. You have to install Node,window under the executable installation package, very simple.
2. Run command: NPM install-g grunt-cli (-G for global installation, can run in any directory) to install the Grunt command-line interface (CLI). Note that installing GRUNT-CLI is not equivalent to installing the Grunt Task Manager. If the installation succeeds, run the command: Grunt-version can see:
3. After entering the project directory, run the command: NPM install Grunt–save-dev installs the latest version of grunt into your project. After the installation is successful, run the command: Grunt-version can see:
4. Create a new Package.json file, as follows
The code is as follows Copy Code
{
"Name": "Grunt",
"Version": "0.1.0″,
"Devdependencies": {
"Grunt": "~0.4.0″,
"Grunt-contrib-jshint": "~0.1.1″,
"Grunt-contrib-nodeunit": "~0.1.2″,
"Grunt-contrib-watch": "~0.2.0″,
"Grunt-contrib-concat": "~0.1.1″,
"Grunt-contrib-uglify": "~0.1.0″,
"Grunt-contrib-cssmin": "~0.9.0″,
"Difflet": "~0.2.3″
}
}
5. Run the command at the project root: npm Install, installing some common grunt plug-ins
6. New Gruntfile.js file
The code is as follows Copy Code
Module.exports = function (grunt) {
Grunt.initconfig ({
Pkg:grunt.file.readJSON (' Package.json '),
Uglify: {
Options: {
Banner: '/*! <%= pkg.name%> <%= grunt.template.today ("Yyyy-mm-dd")%> */n '
},
Build: {
SRC: ' src/test.js ',
Dest: ' Build/test.min.js '
}
}
});
Load plug-ins that provide "uglify" tasks
Grunt.loadnpmtasks (' grunt-contrib-uglify ');
Default Tasks
Grunt.registertask (' Default ', [' uglify ']);
}
7.
9. Run command: Grunt, display as follows:
Running "Default" task
Default
Done, without errors.

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.