1.先安裝nodejs ,npm ,參考html
http://www.cnblogs.com/seanlv/archive/2011/11/22/2258716.htmlnode
2 安裝gruntexpress
百度搜索npm
參考官網:http://www.gruntjs.net/json
菜單欄快速入門grunt
配置:requirejs
1.package.jsonui
{ "name": "demo", "file": "zepto", "version": "0.1.0", "description": "demo", "license": "MIT", "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-copy": "~0.4.1", "grunt-contrib-clean": "~0.5.0", "grunt-strip": "~0.2.1" }, "dependencies": { "express": "3.x" } }
grunt.jsspa
module.exports = function (grunt) { // 項目配置 grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), uglify: { "my_target": { "files": { 'dest/zepto.min.js': ['src/zepto.js'] } } } }); // 加載提供"uglify"任務的插件 grunt.loadNpmTasks('grunt-contrib-uglify'); // 默認任務 grunt.registerTask('default', ['uglify']); }