This project is a templ playground, using WebAssembly (WASM) application to convert Templ templates into Go code and execute them in the go playground, Rendering the result to the user.
- Run the
xc build-wasm
command (If not installed see XC documentation here). - Run the
xc serve
command (If not installed see XC documentation here). - Navigate to
localhost:8080
- Write your Templ code in the editor.
- Click the "Run" button to convert the Templ code into Go code.
- The HTML code will be displayed in the bottom left editor.
- The rendered result on the bottom left preview panel.
Templ: A library for generating Go code from Templ templates. CodeMirror: A versatile text editor implemented in JavaScript for the browser.
Builds templ to go converter wasm module
GOOS=js GOARCH=wasm go build -o public/main.wasm ./templtogo
Install dev dependencies.
go install github.com/a-h/serve@main
Runs a simple web server for local playground development
serve -dir ./public