Getting Started
See tempo in action with a working demo project.
Prerequisites
- Go 1.23+ and
tempoinstalled - see Installation - templ:
go install github.com/a-h/templ/cmd/templ@latest - air:
go install github.com/air-verse/air@latest
Try It
Clone the demo project:
git clone https://github.com/indaco/tempo-demo.git
cd tempo-demo
go mod download
make dev # or: task devOpen http://localhost:7331. You'll get:
- Live reload via
templ - Instant CSS/JS sync via
tempo - A ready-to-use button component with an outline variant
Step-by-Step Walkthrough
Here's how the demo project was built using tempo:
Create a Go module
bashgo mod init github.com/indaco/tempo-demoInitialize tempo
bashtempo initThis generates a
tempo.yamlconfig file. See Configuration for available options.Define a component template
bashtempo component define --jsGenerates reusable templates in
.tempo-files/templates/with a corresponding action file in.tempo-files/actions/. See Templates & Actions to learn more.Create a component
bashtempo component new --name button --jsThis generates:
assets/button/- CSS and JS source filescomponents/button/-.templand.gofiles
Write styles and scripts in
assets/buttonSync everything
bashtempo syncInjects CSS and JS into
.templcomponents using guard markers. See Guard Markers for details.Generate templ code
bashtempl fmt . && templ generateRun the dev server
bashmake dev # or: task devDefine a variant template
bashtempo variant defineCreate the outline variant
bashtempo variant new --name outline --component buttonThis creates:
assets/button/css/variant/outline.csscomponents/button/variant/outline.templ
Write styles for the newly created
outlinevariant inassets/button.Edit assets and enjoy live updates!
Browse the tempo-demo repo for the full source.
Not using scaffolding? You can also run sync standalone.