This is the first day of my participation in the Gwen Challenge in November. Check out the details: the last Gwen Challenge in 2021
preface
Front-end scaffolding is an important milestone in front-end engineering, and Yeoman is an important tool to quickly implement scaffolding. At the same time, Yeoman’s design concept was a good inspiration for us to develop a scaffold ourselves.
What is the Yeoman
Let’s take a look at the instructions on the official website:
“Yeoman helps you quickly start a new project, customizing best practices and tools to help you stay productive. We provide a generator ecosystem, generator is a plug-in that can be run with yo commands to build complete projects or useful parts.”
Yeoman helps 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 a plugin that can be run with the
yo
command to scaffold complete projects or useful parts.
In a nutshell, Yeoman provides a command called yo that quickly generates projects using the Generator plug-in. It also provides an ecosystem where you can choose a generator to use or create one yourself.
It can be inferred from this description that Yeoman provides not only a Yo command, but also a Generator-related API to help you create directories, files, manage dependencies, and so on, simplifying project generation and creation. It can therefore be understood as scaffolding of scaffolding.
Quick start
Install the yo command
npm install -g yo
Copy the code
To install a generator, go to yeoman. IO /generators/
Searching for vUE, we can see that there are several generators, so we can choose a VUe-starter
npm install -g generator-vue-starter
Copy the code
Once installed, you can execute the generator
yo vue-starter
Copy the code
We can take a look at the generated content
This is what the generator provides. As you can see, the Generator is quite old and the dependency configuration is obsolete. We also don’t have to install the dependency to run it, as we will then develop a generator ourselves.