1. 安装nodejs作为js的编译和运行环境
</pre><pre name="code" class="python"> wget https://nodejs.org/dist/v5.9.0/node-v5.9.0-x86.msi
注意根据自己的机器环境下载32位或者64位的版本
2. 安装npm,相当于js的rpm包管理工具
git clone --recursive git://github.com/isaacs/npm.git
在node命令行中执行
node cli.js install npm -gf
3.安装grunt,相当于javascript的make工具
npm install -g grunt-cli
接着安装各种插件
npm install grunt-cmd-transport --save-dev
npm install grunt-cmd-concat --save-dev
npm install grunt-include-replace --save-dev
npm install grunt-contrib-clean --save-dev
npm install grunt-contrib-copy --save-dev
npm install grunt-contrib-watch --save-dev
npm install grunt-contrib-uglify --save-dev
npm install grunt-filerev --save-dev
npm install grunt-usemin --save-dev
npm install grunt-contrib-less --save-dev
4.编辑package.json,定义了js包的版本
{
"name": "video",
"version": "0.1.0",
"devDependencies": {
"copy": "0.0.1",
"grunt": "^0.4.5",
"grunt-cmd-concat": "^0.2.7",
"grunt-cmd-transport": "^0.4.1",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-less": "^0.11.4",
"grunt-contrib-uglify": "^0.5.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^2.0.0",
"grunt-filerev-replace": "^0.1.1",
"grunt-html-build": "*",
"grunt-include-replace": "^2.0.0",
"grunt-usemin": "^2.4.0"
}
}
5.gruntfile.js,相当于makefile