learnlytics-go/templ
2025-03-20 12:35:13 +01:00
..
.github Changed: DB Params 2025-03-20 12:35:13 +01:00
.vscode Changed: DB Params 2025-03-20 12:35:13 +01:00
benchmarks Changed: DB Params 2025-03-20 12:35:13 +01:00
cfg Changed: DB Params 2025-03-20 12:35:13 +01:00
cmd/templ Changed: DB Params 2025-03-20 12:35:13 +01:00
docs Changed: DB Params 2025-03-20 12:35:13 +01:00
examples Changed: DB Params 2025-03-20 12:35:13 +01:00
generator Changed: DB Params 2025-03-20 12:35:13 +01:00
get-version Changed: DB Params 2025-03-20 12:35:13 +01:00
logo Changed: DB Params 2025-03-20 12:35:13 +01:00
lsp Changed: DB Params 2025-03-20 12:35:13 +01:00
parser/v2 Changed: DB Params 2025-03-20 12:35:13 +01:00
runtime Changed: DB Params 2025-03-20 12:35:13 +01:00
safehtml Changed: DB Params 2025-03-20 12:35:13 +01:00
storybook Changed: DB Params 2025-03-20 12:35:13 +01:00
turbo Changed: DB Params 2025-03-20 12:35:13 +01:00
.dockerignore Changed: DB Params 2025-03-20 12:35:13 +01:00
.envrc Changed: DB Params 2025-03-20 12:35:13 +01:00
.gitignore Changed: DB Params 2025-03-20 12:35:13 +01:00
.goreleaser.yaml Changed: DB Params 2025-03-20 12:35:13 +01:00
.ignore Changed: DB Params 2025-03-20 12:35:13 +01:00
.version Changed: DB Params 2025-03-20 12:35:13 +01:00
CODE_OF_CONDUCT.md Changed: DB Params 2025-03-20 12:35:13 +01:00
CONTRIBUTING.md Changed: DB Params 2025-03-20 12:35:13 +01:00
cosign.pub Changed: DB Params 2025-03-20 12:35:13 +01:00
flake.lock Changed: DB Params 2025-03-20 12:35:13 +01:00
flake.nix Changed: DB Params 2025-03-20 12:35:13 +01:00
flush_test.go Changed: DB Params 2025-03-20 12:35:13 +01:00
flush.go Changed: DB Params 2025-03-20 12:35:13 +01:00
go.mod Changed: DB Params 2025-03-20 12:35:13 +01:00
go.sum Changed: DB Params 2025-03-20 12:35:13 +01:00
handler_test.go Changed: DB Params 2025-03-20 12:35:13 +01:00
handler.go Changed: DB Params 2025-03-20 12:35:13 +01:00
ide-demo.gif Changed: DB Params 2025-03-20 12:35:13 +01:00
join_test.go Changed: DB Params 2025-03-20 12:35:13 +01:00
join.go Changed: DB Params 2025-03-20 12:35:13 +01:00
js_test.go Changed: DB Params 2025-03-20 12:35:13 +01:00
js.go Changed: DB Params 2025-03-20 12:35:13 +01:00
jsonscript_test.go Changed: DB Params 2025-03-20 12:35:13 +01:00
jsonscript.go Changed: DB Params 2025-03-20 12:35:13 +01:00
jsonstring_test.go Changed: DB Params 2025-03-20 12:35:13 +01:00
jsonstring.go Changed: DB Params 2025-03-20 12:35:13 +01:00
LICENSE Changed: DB Params 2025-03-20 12:35:13 +01:00
once_test.go Changed: DB Params 2025-03-20 12:35:13 +01:00
once.go Changed: DB Params 2025-03-20 12:35:13 +01:00
push-tag.sh Changed: DB Params 2025-03-20 12:35:13 +01:00
README.md Changed: DB Params 2025-03-20 12:35:13 +01:00
runtime_test.go Changed: DB Params 2025-03-20 12:35:13 +01:00
runtime.go Changed: DB Params 2025-03-20 12:35:13 +01:00
scripttemplate_test.go Changed: DB Params 2025-03-20 12:35:13 +01:00
scripttemplate.go Changed: DB Params 2025-03-20 12:35:13 +01:00
SECURITY.md Changed: DB Params 2025-03-20 12:35:13 +01:00
templ.png Changed: DB Params 2025-03-20 12:35:13 +01:00
url_test.go Changed: DB Params 2025-03-20 12:35:13 +01:00
url.go Changed: DB Params 2025-03-20 12:35:13 +01:00
version.go Changed: DB Params 2025-03-20 12:35:13 +01:00
watchmode.go Changed: DB Params 2025-03-20 12:35:13 +01:00

templ

An HTML templating language for Go that has great developer tooling.

templ

Documentation

See user documentation at https://templ.guide

Go Reference xc compatible Go Coverage Go Report Card

Tasks

build

Build a local version.

go run ./get-version > .version
cd cmd/templ
go build

install-snapshot

Build and install current version.

# Remove templ from the non-standard ~/bin/templ path
# that this command previously used.
rm -f ~/bin/templ
# Clear LSP logs.
rm -f cmd/templ/lspcmd/*.txt
# Update version.
go run ./get-version > .version
# Install to $GOPATH/bin or $HOME/go/bin
cd cmd/templ && go install

build-snapshot

Use goreleaser to build the command line binary using goreleaser.

goreleaser build --snapshot --clean

generate

Run templ generate using local version.

go run ./cmd/templ generate -include-version=false

test

Run Go tests.

go run ./get-version > .version
go run ./cmd/templ generate -include-version=false
go test ./...

test-short

Run Go tests.

go run ./get-version > .version
go run ./cmd/templ generate -include-version=false
go test ./... -short

test-cover

Run Go tests.

# Create test profile directories.
mkdir -p coverage/fmt
mkdir -p coverage/generate
mkdir -p coverage/version
mkdir -p coverage/unit
# Build the test binary.
go build -cover -o ./coverage/templ-cover ./cmd/templ
# Run the covered generate command.
GOCOVERDIR=coverage/fmt ./coverage/templ-cover fmt .
GOCOVERDIR=coverage/generate ./coverage/templ-cover generate -include-version=false
GOCOVERDIR=coverage/version ./coverage/templ-cover version
# Run the unit tests.
go test -cover ./... -coverpkg ./... -args -test.gocoverdir="$PWD/coverage/unit"
# Display the combined percentage.
go tool covdata percent -i=./coverage/fmt,./coverage/generate,./coverage/version,./coverage/unit
# Generate a text coverage profile for tooling to use.
go tool covdata textfmt -i=./coverage/fmt,./coverage/generate,./coverage/version,./coverage/unit -o coverage.out
# Print total
go tool cover -func coverage.out | grep total

test-cover-watch

gotestsum --watch -- -coverprofile=coverage.out

test-fuzz

./parser/v2/fuzz.sh
./parser/v2/goexpression/fuzz.sh

benchmark

Run benchmarks.

go run ./cmd/templ generate -include-version=false && go test ./... -bench=. -benchmem

fmt

Format all Go and templ code.

gofmt -s -w .
go run ./cmd/templ fmt .

lint

Run the lint operations that are run as part of the CI.

golangci-lint run --verbose

ensure-generated

Ensure that templ files have been generated with the local version of templ, and that those files have been added to git.

Requires: generate

git diff --exit-code

push-release-tag

Push a semantic version number to GitHub to trigger the release process.

./push-tag.sh

docs-run

Run the development server.

Directory: docs

npm run start

docs-build

Build production docs site.

Directory: docs

npm run build