{"id":1254,"date":"2015-02-27T21:34:04","date_gmt":"2015-02-27T21:34:04","guid":{"rendered":"http:\/\/www.nikola-breznjak.com\/blog\/?p=1254"},"modified":"2015-08-10T06:50:03","modified_gmt":"2015-08-10T06:50:03","slug":"speeding-up-angular-development-with-yeoman","status":"publish","type":"post","link":"https:\/\/nikola-breznjak.com\/blog\/javascript\/angular\/speeding-up-angular-development-with-yeoman\/","title":{"rendered":"Speeding up Angular development with Yeoman"},"content":{"rendered":"<blockquote><p><a href=\"http:\/\/yeoman.io\/\">Yeoman<\/a>\u00a0helps you to kickstart new projects, prescribing best practices and tools to help you stay productive.<\/p>\n<p>To do so, we provide a generator ecosystem. A generator is basically a plugin that can be run with the `yo` command to scaffold complete projects or useful parts&#8230;<\/p><\/blockquote>\n<p>First, install Yeoman with npm:<\/p>\n<pre class=\"lang:default decode:true\">npm install yo -g<\/pre>\n<p>Now you need a &#8220;generator&#8221;, and most likely you&#8217;ll need grunt:<\/p>\n<pre class=\"lang:default decode:true\">npm install -g generator-angular grunt<\/pre>\n<p>If you get the error like <em>The package generator-karma does not satisfy its siblings&#8217; peerDependencies requirements<\/em>\u00a0then try uninstalling generator-karma:<\/p>\n<pre class=\"lang:default decode:true \">npm uninstall -g generator-karma<\/pre>\n<p>and running the previous npm install command again.<\/p>\n<p>Btw, \u00a0you can use Yeoman&#8217;s CLI (by first executing <strong>yo<\/strong>) to\u00a0search and install any of the existing generators.<\/p>\n<p>To scaffold a new app, create some folder and execute the following command:<\/p>\n<pre class=\"lang:default decode:true\">yo angular myApp<\/pre>\n<p>Yeoman will ask you few questions to which you can all give a default answer and it will start the installation process. After the installation is done you can do:<\/p>\n<pre class=\"lang:default decode:true\">grunt serve<\/pre>\n<p>to actually see a live preview of your scaffolded app.<\/p>\n<p>If you get an error like\u00a0<em>Warning: Couldn&#8217;t find the `compass` binary. Make sure it&#8217;s installed and in your $PATH Use &#8211;force to continue\u00a0<\/em>install it with (if you&#8217;re on Mac):<\/p>\n<pre class=\"lang:default decode:true\">sudo gem install compass<\/pre>\n<p>Additional cool thing is that this generator comes with extra tools for quick scaffolding of routes, controllers, views, directives, services, filters&#8230; Be sure to check the project on <a href=\"https:\/\/github.com\/yeoman\/generator-angular\">GitHub<\/a> for more info.<\/p>\n<p>For example, the following command generates a controller and a view, and configures a route in <em>app\/scripts\/app.js<\/em> connecting them.<\/p>\n<pre class=\"lang:default decode:true\">yo angular:route myroute<\/pre>\n<p>&nbsp;<\/p>\n<p><iframe loading=\"lazy\" width=\"800\" height=\"600\" src=\"https:\/\/www.youtube.com\/embed\/UPphDSc6ZEE?feature=oembed\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yeoman\u00a0helps you to kickstart new projects, prescribing best practices and tools to help you stay productive. To do so, we provide a generator ecosystem. A generator is basically&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1256,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[],"class_list":["post-1254","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-angular"],"_links":{"self":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/1254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/comments?post=1254"}],"version-history":[{"count":4,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/1254\/revisions"}],"predecessor-version":[{"id":1259,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/1254\/revisions\/1259"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media\/1256"}],"wp:attachment":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media?parent=1254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/categories?post=1254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/tags?post=1254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}