{"id":13413857,"url":"https://github.com/a-h/templ","last_synced_at":"2025-05-14T08:02:05.246Z","repository":{"id":36965504,"uuid":"356677177","full_name":"a-h/templ","owner":"a-h","description":"A language for writing HTML user interfaces in Go.","archived":false,"fork":false,"pushed_at":"2025-05-05T08:21:27.000Z","size":8043,"stargazers_count":9147,"open_issues_count":70,"forks_count":307,"subscribers_count":45,"default_branch":"main","last_synced_at":"2025-05-07T07:02:42.354Z","etag":null,"topics":["go","html-elements","htmx","ide-support","language-server","lsp","server-side-rendering","templating-languages"],"latest_commit_sha":null,"homepage":"https://templ.guide/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a-h.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["a-h","joerdav"]}},"created_at":"2021-04-10T19:37:28.000Z","updated_at":"2025-05-07T06:42:23.000Z","dependencies_parsed_at":"2023-09-28T22:02:28.149Z","dependency_job_id":"b97b1354-e193-4016-8c41-4693a284fa0b","html_url":"https://github.com/a-h/templ","commit_stats":null,"previous_names":[],"tags_count":74,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-h%2Ftempl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-h%2Ftempl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-h%2Ftempl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-h%2Ftempl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a-h","download_url":"https://codeload.github.com/a-h/templ/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101581,"owners_count":22014905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","html-elements","htmx","ide-support","language-server","lsp","server-side-rendering","templating-languages"],"created_at":"2024-07-30T20:01:51.316Z","updated_at":"2025-05-14T08:02:05.212Z","avatar_url":"https://github.com/a-h.png","language":"Go","readme":"![templ](https://github.com/a-h/templ/raw/main/templ.png)\n\n## An HTML templating language for Go that has great developer tooling.\n\n![templ](ide-demo.gif)\n\n\n## Documentation\n\nSee user documentation at https://templ.guide\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pkg.go.dev/github.com/a-h/templ\"\u003e\u003cimg src=\"https://pkg.go.dev/badge/github.com/a-h/templ.svg\" alt=\"Go Reference\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://xcfile.dev\"\u003e\u003cimg src=\"https://xcfile.dev/badge.svg\" alt=\"xc compatible\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://raw.githack.com/wiki/a-h/templ/coverage.html\"\u003e\u003cimg src=\"https://github.com/a-h/templ/wiki/coverage.svg\" alt=\"Go Coverage\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://goreportcard.com/report/github.com/a-h/templ\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/a-h/templ\" alt=\"Go Report Card\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Tasks\n\n### version-set\n\nSet the version of templ to the current version.\n\n```sh\nversion set --template=\"0.3.%d\"\n```\n\n### build\n\nBuild a local version.\n\n```sh\nversion set --template=\"0.3.%d\"\ncd cmd/templ\ngo build\n```\n\n### install-snapshot\n\nBuild and install current version.\n\n```sh\n# Remove templ from the non-standard ~/bin/templ path\n# that this command previously used.\nrm -f ~/bin/templ\n# Clear LSP logs.\nrm -f cmd/templ/lspcmd/*.txt\n# Update version.\nversion set --template=\"0.3.%d\"\n# Install to $GOPATH/bin or $HOME/go/bin\ncd cmd/templ \u0026\u0026 go install\n```\n\n### build-snapshot\n\nUse goreleaser to build the command line binary using goreleaser.\n\n```sh\ngoreleaser build --snapshot --clean\n```\n\n### generate\n\nRun templ generate using local version.\n\n```sh\ngo run ./cmd/templ generate -include-version=false\n```\n\n### test\n\nRun Go tests.\n\n```sh\nversion set --template=\"0.3.%d\"\ngo run ./cmd/templ generate -include-version=false\ngo test ./...\n```\n\n### test-short\n\nRun Go tests.\n\n```sh\nversion set --template=\"0.3.%d\"\ngo run ./cmd/templ generate -include-version=false\ngo test ./... -short\n```\n\n### test-cover\n\nRun Go tests.\n\n```sh\n# Create test profile directories.\nmkdir -p coverage/fmt\nmkdir -p coverage/generate\nmkdir -p coverage/version\nmkdir -p coverage/unit\n# Build the test binary.\ngo build -cover -o ./coverage/templ-cover ./cmd/templ\n# Run the covered generate command.\nGOCOVERDIR=coverage/fmt ./coverage/templ-cover fmt .\nGOCOVERDIR=coverage/generate ./coverage/templ-cover generate -include-version=false\nGOCOVERDIR=coverage/version ./coverage/templ-cover version\n# Run the unit tests.\ngo test -cover ./... -coverpkg ./... -args -test.gocoverdir=\"$PWD/coverage/unit\"\n# Display the combined percentage.\ngo tool covdata percent -i=./coverage/fmt,./coverage/generate,./coverage/version,./coverage/unit\n# Generate a text coverage profile for tooling to use.\ngo tool covdata textfmt -i=./coverage/fmt,./coverage/generate,./coverage/version,./coverage/unit -o coverage.out\n# Print total\ngo tool cover -func coverage.out | grep total\n```\n\n### test-cover-watch\n\n```sh\ngotestsum --watch -- -coverprofile=coverage.out\n```\n\n### test-fuzz\n\n```sh\n./parser/v2/fuzz.sh\n./parser/v2/goexpression/fuzz.sh\n```\n\n### benchmark\n\nRun benchmarks.\n\n```sh\ngo run ./cmd/templ generate -include-version=false \u0026\u0026 go test ./... -bench=. -benchmem\n```\n\n### fmt\n\nFormat all Go and templ code.\n\n```sh\ngofmt -s -w .\ngo run ./cmd/templ fmt .\n```\n\n### lint\n\nRun the lint operations that are run as part of the CI.\n\n```sh\ngolangci-lint run --verbose\n```\n\n### ensure-generated\n\nEnsure that templ files have been generated with the local version of templ, and that those files have been added to git.\n\nRequires: generate\n\n```sh\ngit diff --exit-code\n```\n\n### push-release-tag\n\nPush a semantic version number to GitHub to trigger the release process.\n\n```sh\nversion push --template=\"0.3.%d\" --prefix=\"v\"\n```\n\n### docs-run\n\nRun the development server.\n\nDirectory: docs\n\n```sh\nnpm run start\n```\n\n### docs-build\n\nBuild production docs site.\n\nDirectory: docs\n\n```sh\nnpm run build\n```\n\n","funding_links":["https://github.com/sponsors/a-h","https://github.com/sponsors/joerdav"],"categories":["Go","Template Engines","语言资源库","前端开发框架及项目","go","模板引擎","\u003ca name=\"Go\"\u003e\u003c/a\u003eGo"],"sub_categories":["HTTP Clients","go","前端项目_其他","HTTP客户端","Other Software"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-h%2Ftempl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa-h%2Ftempl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-h%2Ftempl/lists"}