Node环境Grunt开发流
官网:http://www.gruntjs.org/
发觉利用grunt打包压缩代码实在太方便了,以下是一个简单例子,更多实例详见官网
/** * Created with JetBrains WebStorm. * User: EX-ZHOULINGFENG001 * Date: 14-1-9 * Time: 上午10:46 * To change this template use File | Settings | File Templates. */ /* * cmd * grunt concat * grunt uglify * grunt cssmin */ module.exports = function(grunt) { grunt.initConfig({ concat : { options: { separator: ';' }, dist: { src: ['src/js/common.js', 'src/js/index.js'], dest: 'concatJs/allJs.js' } }, uglify: { options: { mangle: true }, my_target: { files: { 'minJs/allJs.min.js': ['src/js/common.js', 'src/js/index.js'] } } }, cssmin: { combine: { files: { 'minCss/allCss.css': ['src/css/common.css', 'src/css/index.css'] } } } }); grunt.loadNpmTasks("grunt-contrib-concat"); grunt.loadNpmTasks("grunt-contrib-cssmin"); grunt.loadNpmTasks("grunt-contrib-uglify"); }