The scaffold

Why scaffolding?

Imagine that we are developing a website for the first time, and we need to do everything ourselves, such as: wheel cast graphics, navigation menus, page layout, etc.

So it took a long time to develop the site the first time (say a month), but when we developed the site the second time, much of the code that we had written the first time was reusable (scrolling, navigation menus, page layouts, etc.). So developing the same type of site a second time may take only half a month.

You’ll find,If the code can be reused, it will greatly improve our development efficiency.

Scaffolding is a tool that helps us generate reusable code (project infrastructure) that can increase development efficiency exponentially.

Classification of scaffolding: general purpose scaffolding and special scaffolding.

The role of scaffolding

Create project infrastructure and provide project specifications and conventions.

Yeoman scaffolding

IO/Yo Yeoman is Yeoman’s command line tool that can execute a series of commands. The generator is the concrete scaffolding in Yeoman. For different application scenarios (for example, we use different generators to build websites and apps).

Yeoman used

Take the example of a WebApp generator using Yeoman:

  • Yo: NPM install -global Yo
  • Install generator: NPM install-global generator-webapp
  • Run generator with YO:
mkdir project-name
cd project-name
yo webapp
Copy the code
  • Start the application: NPM run start

A semi-finished web page can be seen in the browserCTRL + C to terminate the batch operation, entercode .Press enter to modify the generated page using VSCode.