Grunt Compressed Files

Source: Internet
Author: User

    1. Install Nodejs, go to Nodejs's official website to download Nodejs, I use the first one as shown:
    2. installing GRUNT-CLInpm install-g grunt-cli
    3. Create the Grunt folder and create the Package.json, gruntfile.js file under the folder
    4. Installing gruntnpm Install grunt
    5. Installing the Grunt plugin npm install grunt-contrib-uglify, Grunt-contrib-jshint, Grunt-contrib-concat
    6. The final execution of the grunt is OK.
    7. Package.json:
      {  "name": "Xcwjs",  "version": "0.1.0",  "description": "Xcwjs",  "Devdependencies": {    "grunt": "~ 0.4.1 ",    " Grunt-contrib-jshint ":" ~0.6.3 ",    " grunt-contrib-uglify ":" ~0.2.1 ",    " Grunt-contrib-requirejs ":" ~0.4.1 ","    grunt-contrib-concat ":" ~0.1.1 ",    " grunt-contrib-copy ":" ~0.4.1 ",    " Grunt-contrib-clean ":" ~0.5.0 ",    " Grunt-strip ":" ~0.2.1 "  },  " dependencies ": {    " Express ":" 3.x "  }}
    8. Gruntfile.js
      module.exports = function (grunt) {//ïîä¿åäöãgrunt.initconfig ({Pkg:grunt.file.readJSON (' Package.json '), C      Oncat: {options: {separator: '; ' }, Dist: {//file to merge src: [' src/addfavor.js ', ' src/arrayhelp.js ', ' src/common.js ', ' src/convertor.js ', ' SR            C/slider.js ', ' src/star.js ', ' src/vticker.js '], dest: ' dest/xcw.js '//merge files into Dest}}, Uglify: { Options: {//Compressed file Header description banner: '/*!<%=Pkg.name%> <%=Grunt.template.today ("YYYY-MM-DD") %>*/\n '}, Build: {src: ' dest/xcw.js ', dest: ' Dest/xcw.min.js '  }        }  });    Load concat and Uglify plugins, respectively, for merging and compressing grunt.loadnpmtasks (' grunt-contrib-concat ');    Grunt.loadnpmtasks (' grunt-contrib-uglify '); Register Task Grunt.registertask (' Default ', [' concat ', ' uglify ']);

Grunt Compressed Files

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.