mac上安装运行grunt构建工具的总结(一)
安装node.js
brew install node.js
安装grunt
npm install -g grunt-cli
1.新建package.json,配置
{ "name": "domain.com", "version": "0.1.0", "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-csslint": "~0.4.0", "grunt-contrib-jshint": "~0.11.1", "grunt-contrib-concat": "~0.5.1", "grunt-contrib-cssmin": "~0.12.2", "grunt-contrib-uglify": "~0.8.0", "grunt-contrib-imagemin": "~0.9.4", "grunt-contrib-watch": "~0.5.0" } }
2.使用sudo npm install安装
3.编写Gruntfile.js文件,检验合并压缩
4.执行grunt命令
附:sea.js模块化代码,grunt打包 https://www.npmjs.com/package/grunt-cmd-combo
压缩图片:smushit img(不好用)---grunt-contrib-imagemin这个插件好用
grunt插件地址:http://gruntjs.com/plugins
参考博客:http://www.cnblogs.com/yexiaochai/p/3603389.html
文章来自:http://www.cnblogs.com/jdhu/p/4375116.html