Two URLs
Http://www.gruntjs.org/docs/getting-started.html
Http://gruntjs.com/plugins
Steps:
1.CD Demo Folder
2. Installing GRUNT-CLI
NPM install-g GRUNT-CLI//Global Install-G
3. Manual production or automatic production Package.json
Automatic NPM init//After entering name and version on Demand ...
4 Creating Gruntfile.js
Touch Gruntfile.js
5. Install plugin plug-in usage see Http://gruntjs.com/plugins
NPM Install grunt--save-dev
NPM Install grunt-contrib-uglify--save-dev
NPM Install Grunt-contrib-watch--save-dev
NPM Install Grunt-contrib-requirejs--save-dev
6. Running
Grunt
The Gruntfile is configured as follows
Module.exports =function(grunt) {//project ConfigurationGrunt.initconfig ({Pkg:grunt.file.readJSON (' Package.json '), uglify: {options: {banner:‘/*! <%= pkg.name%> <%= grunt.template.today ("Yyyy-mm-dd")%> */\n '}, Index: {src: [' Scripts/app/indexapp.js ', ' scripts/controllers/indexctrl.js '],//the source file to compressDest: ' scripts/<%= pkg.name%>.min.js '//post-compressed output position}}, watch: {scripts: {files: [' Scripts/**/*.js '], tasks: [' Requirejs '], Options: {spawn:false}}}, Requirejs: {compile: {options: { BASEURL:".", paths: {requirelib:' Scripts/requiremain/require '}, include:' Requirelib ',//If you need to press the require in (so that the entire project only needs a JS file), set its path, andName: ' Scripts/requiremain/indexmain ', out:' Scripts/requiremain/index.js ',//the file name of the output //optimize: ' None ',//comment out this line can simultaneously compress the merged JS fileMainconfigfile: ' Scripts/requiremain/indexmain.js '//handle module dependencies with a written main.js file } } } }); //Load plug-ins that provide "uglify" tasksGrunt.loadnpmtasks (' grunt-contrib-uglify '); Grunt.loadnpmtasks (' Grunt-contrib-watch '); Grunt.loadnpmtasks (' Grunt-contrib-requirejs '); //Default task uses Uglify //grunt.registertask (' Default ', [' uglify ']); //Default task uses RequirejsGrunt.registertask (' Default ', [' Requirejs ', ' watch ']);};
Demo download please go to angularjs Chinese community 278252889 or Angularjs Chinese Community 2 Group File download
Grunt+requirejs+angularjs Simple Application