Yeoman 是一项伟大的工程,使用Yeoman可快速生成一个web应用,它可以为开发者省去不少的开发时间,是前端项目开发的脚手架工程。快速查看官网
Yeoman的安装
- $
sudo npm install -g yo
- $
sudo npm install -g generator-webapp
- 备注:sudo 在mac或linux系统使用
Yeoman 的三大工具
- yo 脚手架工具
- gulp/grunt等 构建工具
- npm/bower等 包管理工具
Yeoman使用
- 在项目文件夹中输入 $
yo
显示如下
? 'Allo Johnny! What would you like to do? (Use arrow keys)
Run a generator
❯ Webapp
──────────────
Update your generators
Install a generator
Find some help
Get me out of here!
(Move up and down to reveal more choices)
- Webapp 生成webapp的生成器(基于gulp的项目)
? Which additional features would you like to include? (Press <space> to select, <a> to toggle all, <i> to inverse select
ion)
❯ ◉ Sass
◉ Bootstrap
◉ Modernizr
按照提示开始安装, 之后完成就会生成一个含有指定技术栈的项目脚手架工程
- Update your generators 更新你的生成器
'Allo Johnny! What would you like to do? Update your generators
? Generators to update (Press <space> to select, <a> to toggle all, <i> to inverse selection)
❯ ◉ generator-webapp
敲击space键更新, 这是yeoman自带的generator
Install a generator :这里可能会出现问题,出现问题的讨论
关于更多类型和技术栈的生成器
更深入的使用,请阅读Yeoman官方网站的api