Book Image

Learning Yeoman

By : Jonathan Spratley
Book Image

Learning Yeoman

By: Jonathan Spratley

Overview of this book

Table of Contents (17 chapters)
Learning Yeoman
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Modern Workflows for Modern Webapps
Index

The new custom subgenerator


Let's create a subgenerator for the custom generator we just created; this subgenerator is going to simply create a new page in the project and add a link to the page defined in the projects app/index.html file.

To create a new subgenerator, open a terminal and make the generator we created before the current working directory and execute the following command:

$ yo generator:subgenerator page

The preceding command will invoke the generator:subgenerator command, which then scaffolds a subgenerator module definition file and a template in the root of the generator project.

Understanding the subgenerator's directory structure

The directory structure created is relatively simple; it consists of a folder named after the subgenerator, an index.js file that contains the module definition, and a template in the page/templates directory:

page
├── index.js
└── templates
    └── somefile.js

1 directory, 2 files

The directory structure is broken down into the following:

  • page...