grunt init
http://gruntjs.com/project-scaffolding
概述,grunt init 是通过已有的模板来生成项目的骨架(Scaffolding
),所以,第一步需要下载标准的模板,然后通过grunt init
进行初始化
安装 grunt-inint,
1 | >> npm install -g grunt-init |
安装 jquery templates,
1 | >> git clone https://github.com/gruntjs/grunt-init-jquery.git ~/.grunt-init/jquery |
grunt init
命令默认是从 ~/.grunt-init/ 中加载模板的,所以,下载模板的时候,一定要下载到~/.grunt-init
目录中
初始化,在工程根目录中执行
1 | >> grunt-init jquery |
上述命令将会从~/.grunt-init
目录中加载jquery
模板并生成项目的骨架(Scaffolding
)。
生成的项目骨架如下
1 | grunt-test mac$ tree |
非常遗憾的发现,https://github.com/gruntjs 官方工程中,没有grunt-init-angular
,不过可以自己创建一份,然后通过教程然后自己再生成一份。
grunt init angular
Angular App Scaffold, grunt-init-angular-app
下载模板
1
$ git clone https://github.com/thebigredgeek/grunt-init-angular-app.git ~/.grunt-init/angular-app
Then, to create a project, within your project directory:
1
$ grunt-init angular-app
Finally, install the dependencies
1
2$ npm install
$ bower installTODO, bower 是什么?