Business background
-
vue-cli3
some of the official predefined templates cannot meet their needs
- for example, I have common tool libraries, sass styles, and generic ui components that need to be built into templates
- so configure
preset
yourself.
problems encountered
- the official document says that the
render
function in generator.js
can generate the specified file into the project
- but I wrote
with reference to the official example
- the final generated project does not contain some of my preset files
- that is, none of the files under the template directory have been copied
the following is the project file
t/preset.json
{
"plugins": {}
}
t/generator.js
module.exports = api => {
console.log(123123123123);
api.render("./template");
};
t/template
- src
- layouts
- test.js
- test.js
- test.js
troubleshooting
- there is an output of 123123123123 at the terminal, indicating that generator is executed