-
Notifications
You must be signed in to change notification settings - Fork 12k
Custom component suffix --suffix=Route #15680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We still want to stick to the Angular styleguide in the CLI schematics. It is easy to rename components in the IDE. Creating a custom schematics might be the way to go here if you really wanted this behavior. Thanks |
The styleguide says "Invent additional type names if you must but take care not to create too many." which to me sounds like if we find new types which makes sense to us, it's okey. I think this would enable us to better state our intent and by looking at the file we can clearly see that it's a component, so why do we need to keep it in the filenames? I have multiple sub types of components that I build my apps from: .dialog at the moment I'm naming the classes that way RemoveProjectDialogComponent Which also leads to really long filenames remove-project-dialog.component.ts I find it would be more pleasing to have: remove-project.dialog.ts and the same goes for the imports which are really long and hard to eye over. I cannot be the only one not loving the overly complex names. |
@leon - The |
I will add a PR to add a --type option that will set all all spec, class and filenames accordingly. |
the type option allows you to change the default .component.ts suffix to new types. such as Route Dialog UI Container angular#15680
the type option allows you to change the default .component.ts suffix to new types. such as Route Dialog UI Container angular#15680
The PR is complete with all tests passing. |
Documentation will be automatically generated once the version is released. |
My PR got merged, so I'll close this :) 🎆 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🚀 Feature request
Command (mark with an
x
)Description
I would like to be able to change the default .component suffix to something more descriptive.
As most of apps are comprised of components, it would be of more use to easily be able to separate the components into their different type.
nav-bar.ui.ts // presentational component
invoices.container.ts // smart component
users.route.ts // route component
The Style guide mentions that you can add your own types
And I think we should enable people to choose their own file layouts.
This simple addition to the component generator would make this possible without having to resort to manually rename all the source files after generating a new component.
I did previously suggest it here #3913 but the timing was not right and it fell through.
Describe the solution you'd like
To be able to supply the suffix for the component generator
I will gladly submit a pull request if you agree that it would be a good feature.
Describe alternatives you've considered
Rename files manually
Manually renaming all files. Extremely tedious and boring
Creating a custom schematic
Yes I've done this, but because different projects use different base schematics, some cli some nx, I find I usually don't bother.
It could get better with #12157
Then people could create special schematics and you could simply add your favorite generators to your project.
The text was updated successfully, but these errors were encountered: