tmplx
Docs
Playground
GitHub
Playground
Compile
Your page compiles on the server as
pages/index.html
— type-checks only, never runs your code. Standard-library imports only.
pages/index.html — tmplx source
<!DOCTYPE html> <html> <head> <title>Counter</title> <script type="text/tmplx"> var counter int </script> </head> <body> <button tx-onclick="counter--">-</button> <span>{ counter }</span> <button tx-onclick="counter++">+</button> </body> </html>
routes.go — generated Go