cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
761
Views
5
Helpful
0
Comments
asroach
Cisco Employee
Cisco Employee

Over the last year or so, I've been working a lot with AngularJS and Node.  One of the biggest challenges when I started learning Angular in particular, and to a lesser extent Node poses the same challenge, is how to structure your app.

A tool that I learned about to help create apps that are structured using "best practices" is called yeoman.  After using it for some time, I liked it so much, I wanted to create a yeoman generator for our free DevNet Learning Labs to make it easier for people creating them.  The idea behind yeoman is to scaffold an app from a template.  For the longest time, I just had a sample project, and the user would just have to copy it, rename a bunch of files (including properties inside), and usually something wouldn't turn out right.  Automation to the rescue!

While you can certainly create a yeoman generator for scratch, conveniently (and not surprisingly) the folks from yeoman created a generator for creating a generator.  It's called generator-generator!

The basic steps are as follows:

  1. Download and install node (I suggest you use nvm if you don't know about it)
  2. Download and install yo, which is actually yeoman, but just the alias you type on the command line (npm install -g yo).
  3. Finally, you should be able to run generator-generator.  (Note that you prefix your generator with generator-).  Hence my generator was named generator-devnet-learninglabs.  Kind of a keyboard full, but alas, I wanted it to be descriptive.

You can get pretty fancy, but I stuck to a basic set of questions to generate the scaffolded Learning Lab.  You can find the end result on GitHub.

Keep coding!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: