cli组件生成器生成其他文件

cli组件生成器生成其他文件

本文介绍了Angular-cli组件生成器生成其他文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以替代

Is there a way to override the default behavior of the

ng generate component

命令?除了此命令默认创建的文件之外,我还希望它生成一个嵌套文件夹,并在所创建的组件内的该文件夹中生成多个文件.

command? In addition to the files that this command creates by default, I am wanting to have it generate a nested folder and several files within that folder inside the component that is created.

推荐答案

使用其他命令生成其他文件.您可以在 https://github.com/angular/angular-cli

Additional files are generated using additional commands. You can find a reference to it on https://github.com/angular/angular-cli

+-----------+---------------------------------+
| Scaffold  | Usage                           |
+-----------+---------------------------------+
| Component | ng g component my-new-component |
+-----------+---------------------------------+
| Directive | ng g directive my-new-directive |
+-----------+---------------------------------+
| Pipe      | ng g pipe my-new-pipe           |
+-----------+---------------------------------+
| Service   | ng g service my-new-service     |
+-----------+---------------------------------+
| Class     | ng g class my-new-class         |
+-----------+---------------------------------+
| Interface | ng g interface my-new-interface |
+-----------+---------------------------------+
| Enum      | ng g enum my-new-enum           |
+-----------+---------------------------------+
| Module    | ng g module my-module           |
+-----------+---------------------------------+

这篇关于Angular-cli组件生成器生成其他文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!