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

L&D: Templ #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

L&D: Templ #2

wants to merge 4 commits into from

Conversation

denialanderror
Copy link
Contributor

Swaps out standard Golang templating for Templ. Benefits are as follows:

  • Allows templates to be written as Go functions (meaning everything you could do in Go, you can do in a templ function)
  • Function parameters are typed (like any Go function) so we have compile time type checking
  • Component parameters can be defined alongside the template they relate to
  • Only valid HTML can be compiled to a component, so compile time validation
  • Easier to unit test without having to use Cypress, which will allow us to properly separate concerns between true E2E testing and component tests
  • Simplifies our conditional htmx rendering and handler logic

From my extensive research, this is by far the most popular stack for Golang and htmx. It is a very widely used and well-maintained library with lots of active development. The only real concerns are that it is still fairly young and therefore prone to major changes, though these appear to have been rolled out with decent migration guides to date, and the IDE support isn't great, though better than we have at current with zero type checking or linting.

@denialanderror denialanderror requested review from a team as code owners July 31, 2024 15:57
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

Successfully merging this pull request may close these issues.

1 participant