Suggestion: include customization options for the templates
It would be great to have a few options for customization when generating a new project through the templates, including having Tailwind wired up to the .csproj instead of using the CDN or not creating the example posts.
I agree that this should be part of the overall dotnet new magic we aim to achieve.
The concept of BlazorStatic templates revolves around "delivering the best default customization" while maintaining the promise that "it works just like any other Blazor app."
I believe the dotnet new template is the optimal way to utilize the robust templating system of .NET (see dotnet/templating), while keeping the main library clean and straightforward. However, when using a template, you cannot reconfigure certain settings files to apply changes immediately—you would need to create a new project instead.
Templates will always be opinionated, for example:
- Which (if any) CSS libraries to use
- The default appearance
- Including some default configurations, etc.
We have two approaches for template customization:
- Using parameters, like
dotnet new BlazorStaticMinimalBlog --exclude-example-posts - Creating new templates, such as
dotnet new BlazorStaticPortfolio
I'm uncertain about the extent of template customization we can achieve, but if you examine the BlazorWebTemplate, it seems quite extensive. However, for example, switching from Tailwind to Bootstrap might necessitate creating a new template.
Another consideration is keeping the template project compatible with the GitHub "Use this template" green button. This will become increasingly difficult to maintain within a single project as more and more different files or lines of code are included (for example, --no-tw-cdn would exclude the CDN link, while the default option would include it).
So, my proposal is to just try it. Start with a simple option like --exclude-example-posts and gradually build towards more complex solutions based on demand. Eventually, I envision having around ten themes as part of the BlazorStatic.Templates project, with multiple subprojects maintained by different contributors—but that vision is probably for the more distant future.
Would you be willing to try implementing the --exclude-example-posts option? I can share everything I know about it (from my extensive experience of creating one template so far). For example this ps1 script was quite helpful with testing...