简体   繁体   English

我可以为 Angular CLI 生成的源创建自定义模板吗

[英]Can I create custom templates for sources generated by Angular CLI

When I execute the following command in an Angular 9 project to generate eg a component当我在 Angular 9 项目中执行以下命令以生成例如一个组件时

$ ng generate component

I would like to customize the sources generated - in particular the unit and e2e test files.我想自定义生成的源 - 特别是单元和 e2e 测试文件。

Is there a mechanism for me to provide templates, or modify existing ones?是否有一种机制可以让我提供模板或修改现有模板?

they should also be accessible to all team members on my project.我的项目中的所有团队成员也应该可以访问它们。

I am aware of yo generators , but I'd prefer to stick with ng .我知道yo generators ,但我更愿意坚持使用ng

They are called Schemactics and there is an official documentation for it.它们被称为 Schemactics,并且有它的官方文档。 You can find it here: https://angular.io/guide/schematics你可以在这里找到它: https : //angular.io/guide/schematics

You can also find a lot of good guides around the Internet regarding this topic, i guess you were just missing the correct name to find the information :)您还可以在 Internet 上找到很多关于此主题的优秀指南,我猜您只是缺少正确的名称来查找信息:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM