studio3s / ng-generators
Artisan 的 Angular 生成器
dev-main
2022-02-20 09:43 UTC
Requires (Dev)
- illuminate/console: dev-master
- illuminate/support: dev-master
This package is auto-updated.
Last update: 2024-09-20 15:51:20 UTC
README
Artisan 的 AngularJS 生成器。最初创建于 laravel5-angular-material-starter。
安装
如果您正在使用启动项目,那么它已经预先安装。
composer require studio3s/ng-generators
//and then add the provider in config/app.php
Studio3s\Generators\LaravelServiceProvider::class,
php artisan vendor:publish
使用
php artisan ng:page name #New page inside angular/app/pages/ php artisan ng:component name #New component inside angular/app/components/ php artisan ng:directive name #New directive inside angular/directives/ php artisan ng:config name #New config inside angular/config/ php artisan ng:dialog name #New custom dialog inside angular/dialogs/ php artisan ng:filter name #New filter inside angular/filters/ php artisan ng:service name #New service inside angular/services/
以下命令将为 AngularJS 前端创建新的目录和文件,使用新的 ES6 语法。如果不存在,则命令将创建索引文件(例如:index.components.js),如果启用,则新创建的类将被导入。
配置可在 config\generators.php 中编辑。下面有详细信息。
配置
- source:目录名称。它们为新创建的文件创建路径
- root:所有创建的文件和文件夹将被放置的目录名称。
- 其他条目指示文件将被放置的目录。例如,运行
php artisan ng:component name将为组件name创建三个新的文件,路径为root/components/name/。默认为angular/app/components/name/
- suffix:附加到文件名上的名称和扩展名。例如:运行
php artisan ng:directive name将创建一个名为name.directive.js的文件。- stylesheet:样式表的扩展名。注意:为页面和组件都创建了样式表
- 测试
- enable:是否启用或禁用测试文件的创建
- source:与
source相同,但用于测试文件
- misc.auto_import:是否启用或禁用索引文件中的自动导入。
- angular_modules:用于 angular 根模块和子模块的配置。如果索引文件在创建之前或手动创建,这些设置将帮助识别 angular 模块以进行自动导入。如果索引文件在首次运行命令时创建,这些设置将为您创建 angular 模块。
- root:angular 根模块。
- standalone:如果模块被定义为独立(即:
angular.module('mymodule', []))还是根模块的一部分(即:angular.module('mymodule'))。如果设置为 false,则忽略use_prefix、prefix和suffix,并使用根模块名称。 - prefix 和 suffix:类型为
prefix.suffix的模块名称;例如:app.components。 - use_prefix:是否为模块名称使用前缀
文档
贡献者
最初创建于 laravel5-angular-material-starter,然后由 @m33ch 移动到单独的包。
注意
- 不要附加单词
service,它将自动为您添加。