Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mgdm/go-templates-question
https://github.com/mgdm/go-templates-question
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mgdm/go-templates-question
- Owner: mgdm
- Created: 2021-10-23T20:15:27.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-31T17:49:06.000Z (about 3 years ago)
- Last Synced: 2024-10-14T12:36:01.149Z (3 months ago)
- Language: Go
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
I had hoped that I could build a webapp and embed all the templates using `//go:embed`, parse them all into one `template.Template` instance, and then later use `ExecuteTemplate` on that to render the right template for each page. However, I can't seem to make that work, I get the wrong template executed no matter what order I load the templates in, and whether I use `ParseFiles`, `ParseFS`, or `ParseGlob`.
Anyone know why? Do I need a separate `template.Template` instance for each page?