{"id":39387034,"url":"https://github.com/nokacper24/static-templ","last_synced_at":"2026-01-18T03:04:18.169Z","repository":{"id":242571710,"uuid":"806090176","full_name":"nokacper24/static-templ","owner":"nokacper24","description":"Static html file generator for templ","archived":false,"fork":false,"pushed_at":"2025-04-13T19:16:10.000Z","size":96,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-13T20:25:56.616Z","etag":null,"topics":["cli","go-templ","static-site-generator","templ"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nokacper24.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-05-26T10:53:27.000Z","updated_at":"2025-04-13T19:16:14.000Z","dependencies_parsed_at":"2024-06-29T15:57:28.029Z","dependency_job_id":"ab7373cc-4d29-4c06-ba83-bc2f751d5d0f","html_url":"https://github.com/nokacper24/static-templ","commit_stats":null,"previous_names":["nokacper24/static-templ"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/nokacper24/static-templ","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokacper24%2Fstatic-templ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokacper24%2Fstatic-templ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokacper24%2Fstatic-templ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokacper24%2Fstatic-templ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nokacper24","download_url":"https://codeload.github.com/nokacper24/static-templ/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokacper24%2Fstatic-templ/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28528026,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cli","go-templ","static-site-generator","templ"],"created_at":"2026-01-18T03:04:17.522Z","updated_at":"2026-01-18T03:04:18.154Z","avatar_url":"https://github.com/nokacper24.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Static Templ\n\n[![release](https://github.com/nokacper24/static-templ/actions/workflows/release.yml/badge.svg)](https://github.com/nokacper24/static-templ/actions/workflows/release.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/nokacper24/static-templ)](https://goreportcard.com/report/github.com/nokacper24/static-templ)\n[![Version](https://badge.fury.io/gh/nokacper24%2Fstatic-templ.svg)](https://badge.fury.io/gh/nokacper24%2Fstatic-templ)\n[![Go Reference](https://pkg.go.dev/badge/github.com/nokacper24/static-templ/.svg)](https://pkg.go.dev/github.com/nokacper24/static-templ/)\n[![License](https://img.shields.io/github/license/nokacper24/static-templ)](https://github.com/nokacper24/static-templ/blob/main/LICENSE)\n\nBuild static HTML websites with file based routing, using [templ](https://github.com/a-h/templ)! All components are pre-rendered at build time, and the resulting HTML files can be served using any static file server.\n\n## Installation\n\n```bash\ngo install github.com/nokacper24/static-templ@latest\n```\n\n## Usage\n\n```bash\nUsage of static-templ:\nstatic-templ [flags] [subcommands]\n\nFlags:\n  -m  Set the operational mode: bundle or inline. (default \"bundle\").\n  -i  Specify input directory (default \"web/pages\").\n  -o  Specify output directory (default \"dist\").\n  -f  Run templ fmt.\n  -g  Run templ generate.\n  -d  Keep the generation script after completion for inspection and debugging.\n\nSubcommands:\n  version  Display the version information.\n\nExamples:\n  # Specify input and output directories\n  static-templ -i web/demos -o output\n\n  # Specify input directory, run templ generate and output to default directory\n  static-templ -i web/demos -g=true\n\n  # Display the version information\n  static-templ version\n```\n\n### Modes\n\nThe `-m` flag helps addressing two specific use-cases supported by `static-templ`:\n\n- **Bundle Mode** (`bundle`): Generates HTML files in the specified output directory, mirroring the structure of the input directory. This mode is useful for converting a full set of pages. It reflects the original `static-templ` way of working.\n- **Inline Mode** (`inline`): Generates HTML files in the same directory as their corresponding `.templ` files. This mode is useful for smaller projects, single-component development or for documenting components.\n\n## Assumptions\n\nTempl components that will be turned into html files must be **exported**, and take **no arguments**. If these conditions are not met, the component will be ignored. Your components must be in the *input* directory, their path will be mirrored in the *output* directory.\n\nBy default (`mode=bundle`) all files other than `.go` and `.templ` files will be copied to the output directory, preserving the directory structure. This allows you to include any assets and reference them using relative paths.\n\n## Background\n\nTempl does support rendering components into files, as shown in their [documentation](https://templ.guide/static-rendering/generating-static-html-files-with-templ/). I wanted to avoid manually writing code for each page.\n\n`static-templ` creates a script that renders the desired components, writes them into files, executes the script, and cleans up afterward.\n\n## Contribution\n\nContributions are welcome! If you have suggestions for improvements or new features, please submit an issue or a pull request.\n\nBefore submitting a pull request, please follow these steps to ensure a smooth and consistent development process:\n\n### Setting Up Git Hooks\n\nWe use Git hooks to automate versioning and ensure code quality. After cloning the repository, you must set up the Git hooks by running the following script. This step ensures that the hooks are properly installed and executed when needed.\n\n1. Clone the repository:\n\n    ```bash\n    git clone https://github.com/nokacper24/static-templ.git\n    cd static-templ\n    ```\n\n2. Run the setup script to install the Git hooks:\n\n    **For Unix-based systems (Linux, macOS):**\n\n    ```bash\n    ./setup-hooks.sh\n    ```\n\n    **For Windows systems:**\n\n    ```cmd\n    setup-hooks.bat\n    ```\n\nBy running the appropriate setup script, you ensure that the pre-commit hook is properly installed. This hook will automatically update the version number in the `.version` file and stage it for commit.\n\n### Creating a Release\n\nFollow these steps to create a new release:\n\n1. **Update the version**\n   - Edit the `.version` file and set the new version number.\n\n2. **Commit and push changes**\n   - Create an empty commit to indicate the release:\n\n     ```bash\n     git commit --allow-empty -m \"chore: release vX.X.X\"\n     git push origin main\n     ```\n\n3. **Tag the release and push it**\n   - Create and push a version tag:\n\n     ```bash\n     git tag vX.X.X\n     git push origin vX.X.X\n     ```\n\nYour release is now tagged and ready.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnokacper24%2Fstatic-templ","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnokacper24%2Fstatic-templ","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnokacper24%2Fstatic-templ/lists"}