Warning: this post is old and might not reflect the current state of the art
警告:此帖子过时,可能无法反映当前的最新状态
Yeoman is one of the cool kids in the yard, a combined effort of a lot of respectable developers to provide a tool that simplifies the setup and management of web app projects: less time spent in learning X different tools, more consistency and ease of use.
Yeoman是院子里最酷的孩子之一,许多受人尊敬的开发人员共同努力,提供了一种简化Web应用程序项目的设置和管理的工具:减少了学习X个不同工具的时间,提高了一致性和易用性。
There are a lot of points of interest in Yeoman, the most important of them are:
约曼有很多景点,其中最重要的是:
- it is built upon rock-solid tools to provide an easy access and quick, no-brainer use of them. Does not re-invent the wheel. 它建立在坚如磐石的工具上,可以轻松访问它们,并且快速,轻松地使用它们。 不要重新发明轮子。
- it is a scaffolding tool for the most popular frameworks, think Bootstrap, Ember.js, Angular.js, Backbone.js 它是适用于大多数流行框架的脚手架工具,例如Bootstrap,Ember.js,Angular.js,Backbone.js
thanks to Bower (a frontend package manager similar to Jam, Volo, Ender - but better), it has quick install, uninstall and update helpers for common libs such as jQuery, Underscore.js, Modernizer, Mocha, Backbone, and any Bower package already in place.
感谢Bower (类似于Jam,Volo,Ender的前端软件包管理器-但更好),它可以快速安装,卸载和更新常见库(例如jQuery,Undercore.js,Modernizer,Mocha,Backbone和任何Bower软件包)的帮助程序。已经到位。
- it has testing built-in, using mocha against a PhantomJS (headless browser) instance when launched from the command line, or otherwise tests run in the browser when you open the test/index.html page in the browser. 它具有内置测试功能,可以从命令行启动时针对PhantomJS(无头浏览器)实例使用mocha,或者在浏览器中打开test / index.html页面时以其他方式在浏览器中运行测试。
- it provides a python HTTP server to test out your code. When the webserver is running, it listens for file changes in your project and reloads the browser when the page you have open has dependencies on a file that changed. So, you don’t even need a backend in place before starting writing the frontend code. 它提供了一个python HTTP服务器来测试您的代码。 当Web服务器运行时,它会侦听项目中的文件更改,并在打开的页面依赖于更改文件的情况下重新加载浏览器。 因此,在开始编写前端代码之前,您甚至都不需要后端。
Building an Yeoman project is easy. First, install it:
建立Yeoman项目很容易。 首先,安装它:
$ curl -L get.yeoman.io | sh
$ curl -L get.yeoman.io | sh
Then enter in an empty directory and type
然后输入一个空目录并键入
$ yeoman init
$ yeoman init
This will present you a welcome screen, and a list of options of what you’d like to add to the project.
这将为您显示一个欢迎屏幕,以及您想要添加到项目中的选项的列表。
You can start a new Ember.js project by typing
您可以通过键入以下内容来启动新的Ember.js项目
$ yeoman init ember
$ yeoman init ember
This creates a new Ember.js app, creates a basic set of models, controllers and views/templates (and their directories), adds the script tags for all dependencies (jQuery, Handlebars) and creates an index.html file based on the HTML5 boilerplate project http://html5boilerplate.com/.
这将创建一个新的Ember.js应用,创建一组基本的模型,控制器和视图/模板(及其目录),为所有依赖项(jQuery,Handlebars)添加脚本标签,并基于HTML5创建index.html文件样板项目http://html5boilerplate.com/ 。
You can use Yeoman to bootstrap the project, update dependencies in your project, run tests and so on. And, when the project is ready for deployment, you can take advantage of Grunt https://github.com/cowboy/grunt built in Yeoman by calling “yeoman build”, so that it lints, compiles everything for production, concatenates and minifies script and styles, compresses images and so on.
您可以使用Yeoman引导项目,更新项目中的依赖项,运行测试等。 而且,当项目准备好进行部署时,您可以通过调用“ yeoman build”来利用在Yeoman中构建的Grunt https://github.com/cowboy/grunt ,以使其棉绒,编译所有内容以进行生产,连接并最小化。脚本和样式,压缩图像等。