templ
templ copied to clipboard
Proposal: create a templ init comand to create a starter website
The starter website might have:
-
/scripts
- TypeScript or ES6 in here would be transpiled by esbuild.-
package.json
- To enable the use of 3rd party JavaScript packages. -
default.ts
- Will end up in thescripts/dist
directory asdefault.js
.
-
-
/routes
-
/default
-
default.templ
- Template for the/
page. -
default.go
- HTTP handler for/
.
-
-
/about
-
about.templ
- Template for the/about
page. -
about.go
- HTTP handler for/about
.
-
-
/register
-
register.templ
- Template for the/register
page. -
register.go
- HTTP handler for/register
.
-
-
-
router.go
- provides a router. -
/layout
-
/global
-
page.templ
- Overall template -
header.templ
- Header template -
footer.templ
- Footer template
-
-
-
/static
-
logo.png
- image to include.
-
-
main.go
- Entry point that runs everything as a web server. -
README.md
- includes tasks that demonstrate how to run everything, includingtempl generate
,esbuild
operations, hot reload.
Ideally, it would also have a way to output a CDK compatible version for AWS hosting, and maybe include a Github Actions or similar way of building.
Maybe there's a template project builder that can be applied for this purpose?
This could be done via the go new
command now, just needs a go new compatible template repo to be created.
Is there anything fixed for the go new
command? I only found https://github.com/golang/go/discussions/61669
Nothing fixed, I think the thread you found is where it's up to.
@a-h i am trying to do that by creating https://github.com/gozinc/zinc
And there is also https://github.com/anthdm/slick A fair few people have some templates to scaffold their preferred stack.
Marking this as needs decision, whether or not we will do something for this.
The repo https://github.com/Melkeydev/go-blueprint had added an option for a templ/htmx starter project. An option could be to mention it in the docs.
Okay, yes I agree. A list of starter projects and what they provide could be sufficient for now. Will put this as needs fix, for if someone would like to start the list in the docs.