https://github.com/a-h/templ Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} a-h / templ Public * Notifications * Fork 97 * Star 3k A language for writing HTML user interfaces in Go. License MIT license 3k stars 97 forks Activity Star Notifications * Code * Issues 47 * Pull requests 5 * Discussions * Actions * Projects 0 * Wiki * Security * Insights Additional navigation options * Code * Issues * Pull requests * Discussions * Actions * Projects * Wiki * Security * Insights a-h/templ This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 4 branches 48 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/a] Use Git or checkout with SVN using the web URL. [gh repo clone a-h/te] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @caarlos0 @a-h 3 authors fix: nix documentation, CGO typo and flake overlay (#323) ... 9622ae2 Dec 11, 2023 fix: nix documentation, CGO typo and flake overlay (#323) Co-authored-by: Adrian Hesketh Co-authored-by: Adrian Hesketh 9622ae2 Git stats * 484 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows docs: deploy on new releases, not every push, fixes #298 November 15, 2023 14:14 benchmarks fix: remove escaping for ConstantAttribute (#293) (#295) November 14, 2023 08:44 cmd/templ fix: 'generate -watch' stops sleeping between iterations after 15min (#... December 4, 2023 19:30 docs fix: nix documentation, CGO typo and flake overlay (#323) December 11, 2023 17:01 examples feat: warn when using legacy call syntax (#303) November 27, 2023 15:24 generator feat: warn when using legacy call syntax (#303) November 27, 2023 15:24 get-version chore: add start of unit tests for CLI October 29, 2023 11:04 logo feat: add docusaurus (#69) April 14, 2023 10:35 parser feat: warn when using legacy call syntax (#303) November 27, 2023 15:24 safehtml chore: fix typo in style.go (#188) October 2, 2023 07:16 storybook chore: regenerate template files, see previous commit August 16, 2023 11:05 turbo feat: make version optional, and allow timestamp in generated output - ... October 28, 2023 15:30 .dockerignore feat: add Nix development flake with Neovim config April 23, 2023 17:42 .gitignore updated formatting to suggested style in #87 September 27, 2023 08:35 .goreleaser.yaml chore: use a pre-commit hook to set a .version file instead of using git October 23, 2023 20:28 .version refactor: add example of allocation test for parser November 26, 2023 14:05 CODE_OF_CONDUCT.md chore: conduct.md October 31, 2023 19:16 CONTRIBUTING.md docs: add CONTRIBUTING.md guide October 31, 2023 10:24 LICENSE Create LICENSE May 19, 2021 12:45 README.md chore: bump version November 6, 2023 09:33 SECURITY.md docs: create SECURITY.md October 31, 2023 10:41 flake.lock feat: update flake and related docs (#241) October 29, 2023 15:23 flake.nix fix: nix documentation, CGO typo and flake overlay (#323) December 11, 2023 17:01 go.mod feat: warn when using legacy call syntax (#303) November 27, 2023 15:24 go.sum feat: warn when using legacy call syntax (#303) November 27, 2023 15:24 ide-demo.gif docs: improve quality of README GIF (#205) October 5, 2023 10:02 push-tag.sh chore: use a pre-commit hook to set a .version file instead of using git October 23, 2023 20:28 runtime.go refactor: reduce memory allocations during parsing and generation (# 301) November 18, 2023 09:08 runtime_test.go feat: remove class name sanitization, since CSS class names are alrea... November 11, 2023 10:04 templ.png Changed the logo to a more appealing design. (#44) March 20, 2022 22:09 version.go chore: use a pre-commit hook to set a .version file instead of using git October 23, 2023 20:28 View code [ ] A HTML templating language for Go that has great developer tooling. Documentation Tasks build install-snapshot build-snapshot generate test test-cover benchmark fmt lint release docs-run docs-build README.md templ A 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 to ~/bin rm cmd/templ/lspcmd/*.txt || true go run ./get-version > .version cd cmd/templ && go build -o ~/bin/templ 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-cover Run Go tests. # Create test profile directories. mkdir -p coverage/fmt mkdir -p coverage/generate 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 # Run the unit tests. go test -cover ./... -args -test.gocoverdir="$PWD/coverage/unit" # Display the combined percentage. go tool covdata percent -i=./coverage/fmt,./coverage/generate,./coverage/unit # Generate a text coverage profile for tooling to use. go tool covdata textfmt -i=./coverage/fmt,./coverage/generate,./coverage/unit -o coverage.out # Print total go tool cover -func coverage.out | grep total 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 golangci-lint run --verbose release Create production build with goreleaser. if [ "${GITHUB_TOKEN}" == "" ]; then echo "No github token, run:"; echo "export GITHUB_TOKEN=`pass github.com/goreleaser_access_token`"; exit 1; fi ./push-tag.sh goreleaser --clean docs-run Run the development server. Directory: docs npm run start docs-build Build production docs site. Directory: docs npm run build About A language for writing HTML user interfaces in Go. Topics go language-server server-side-rendering html-elements hacktoberfest ide-support lsp htmx templating-languages Resources Readme License MIT license Code of conduct Code of conduct Security policy Security policy Activity Stars 3k stars Watchers 24 watching Forks 97 forks Report repository Releases 44 v0.2.476 Latest Nov 16, 2023 + 43 releases Packages 0 No packages published Used by 175 * @aristidebm * @Eluamous-droid * @takagiro2 * @Blechlawine * @brayden-ooi * @cugu * @AuStien * @otaxhu + 167 Contributors 46 * @a-h * @joerdav * @wdscxsj * @headblockhead * @mattn * @gungun974 * @evan-mai * @vrischmann * @aranw * @dvorakluk * @angaz * @a-mesin * @agalbenus * @KasonBraley + 32 contributors Languages * Go 98.3% * HTML 1.1% * Other 0.6% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * You can't perform that action at this time.