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

[Feature Request] add an option to specify templates' location #606

Open
badersur opened this issue Aug 23, 2017 · 1 comment
Open

[Feature Request] add an option to specify templates' location #606

badersur opened this issue Aug 23, 2017 · 1 comment
Labels

Comments

@badersur
Copy link
Contributor

The scaffolding tool is great but it's tied to use bootstrap 3 and tweaking generated files for every project is annoying and time consuming! It would be nice to be able to pass a template's folder and the engine looks for templates inside it and use whatever available and use the current default template's path as a last resort!

I would love to provide the path and have the engine to look for templates as follows:

  1. use the provided path to look for the full template name (i.e. 2.0.0/Templates/ViewGenerator/... as used inside ~/.nuget)
  2. look for the file name only (for convenience and it's easier to create)
  3. read appsettings.*.json to know the template's folder (if I didn't provide a path)
  4. read some configuration file about custom template's folder (eg. ~/.aspcoreconfig?)
  5. use the default location

I'm thinking about a similar approach for dotnet new to provide a different _layout.cshtml that uses bootstrap 4 or any other framework!

@vijayrkn vijayrkn changed the title Feature request: add an option to specify templates' location [Feature Request] add an option to specify templates' location Nov 10, 2019
@bricelam
Copy link
Contributor

bricelam commented Feb 9, 2022

One way to do this, that would be a lot like the old way of doing it, would be to modify TemplateFoldersUtilities to include the root project directory in its search path. (Probably requires a few more changes than just that, but you get the idea.)

After that, you would be able to add a Templates\MvcLayout\_Layout.cshtml file to your project that would be used instead.

Admittedly, this isn't very useful for files like _Layout.cshtml that are only generated once since you could just as easily add it to its final location. But it could be useful for things like views and controllers.

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

No branches or pull requests

3 participants