Skip to content
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

Custom templates #822

Open
daxartio opened this issue Oct 10, 2024 · 2 comments
Open

Custom templates #822

daxartio opened this issue Oct 10, 2024 · 2 comments
Milestone

Comments

@daxartio
Copy link

daxartio commented Oct 10, 2024

Description

I think it would be a good idea if we could use our own templates instead of ones like this

const HTMX_VIEW_EDIT_SCAFFOLD_T: &str = include_str!("templates/scaffold/htmx/view_edit.t");

Expected Behavior

Developers can configure their own templates in their applications. By default, it will work as it does now.

@kaplanelad
Copy link
Contributor

Hey @daxartio,

Thanks for the suggestion, it sounds like a great idea!

To be clear, how would you envision editing the templates? For example, with the scaffold, multiple templates are involved. Would you expect to customize just one template, or would you need to modify all of them?

How would you expect the CLI flags to behave when specifying custom templates?

@jondot jondot added this to the backlog milestone Oct 13, 2024
@daxartio
Copy link
Author

I expect this behavior to work like this.
Developers have their own templates in their repositories or in different directories on their local machines.
There is a global config, or a local one for a specific project, that includes the path to the templates. They can also pass an argument through the CLI.
When they generate something, loco-rs uses the developer's templates.
We can also create custom starters, following the same idea.

I think a single template configuration should be enough. The priority of configurations is as follows: CLI argument -> local -> global. I’m not entirely sure about the local and global configurations; maybe they will work through environment variables or a configuration file.

Most likely, users will provide the same files and structure as in the loco-rs repository, and if certain files are missing, loco-rs will use the default templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants