{"id":40611020,"url":"https://github.com/sidx1024/svelte-to-html","last_synced_at":"2026-01-21T05:10:43.087Z","repository":{"id":42481458,"uuid":"476298702","full_name":"sidx1024/svelte-to-html","owner":"sidx1024","description":"A command to quickly transform a Svelte file into static html.","archived":false,"fork":false,"pushed_at":"2023-06-19T14:47:29.000Z","size":48,"stargazers_count":13,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T16:53:46.823Z","etag":null,"topics":["html","svelte","template","transform"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/sidx1024.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}},"created_at":"2022-03-31T12:36:43.000Z","updated_at":"2024-12-24T00:06:10.000Z","dependencies_parsed_at":"2022-09-26T20:53:36.331Z","dependency_job_id":null,"html_url":"https://github.com/sidx1024/svelte-to-html","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sidx1024/svelte-to-html","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidx1024%2Fsvelte-to-html","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidx1024%2Fsvelte-to-html/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidx1024%2Fsvelte-to-html/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidx1024%2Fsvelte-to-html/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sidx1024","download_url":"https://codeload.github.com/sidx1024/svelte-to-html/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidx1024%2Fsvelte-to-html/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28627390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["html","svelte","template","transform"],"created_at":"2026-01-21T05:10:43.020Z","updated_at":"2026-01-21T05:10:43.080Z","avatar_url":"https://github.com/sidx1024.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Svelte to HTML\n\n- `svelte-to-html` is a command to quickly transform a Svelte file into static html.\n- Props can be supplied to the main Svelte file.\n- The main Svelte file can import other Svelte components or JavaScript files.\n\n## What this is not?\n\n- This command is not a replacement for SvelteKit. It does not ship any JavaScript nor does it include any head or body tag.\n- It obviously does not support any DOM APIs like window, location, navigator etc.\n\n## Why?\n\n- For scenarios where you'd want to generate a static HTML file but with if/else conditionals or for loops. [Svelte's templating features and syntax](https://svelte.dev/docs#template-syntax-if) come to rescue.\n- Ideal for creating templates for GitHub comments which can be used in GitHub Actions.\n\n## Usage (CLI)\n\n```sh\nnpx svelte-to-html \u003cfilepath\u003e \u003coutput\u003e \u003cprops\u003e\n\n# Props as json string\nnpx svelte-to-html filepath.svelte output.html '{\"food\":\"Pizza\"}'\n\n# Props as json file\nnpx svelte-to-html filepath.svelte output.html props.json\n```\n\n## Usage (Compiler API)\n```js\nconst { compile } = require('svelte-to-html');\ncompile('filepath.svelte', { food: 'Pizza' }).then(html =\u003e console.log(html));\n```\n\n### Example\n\n#### Input\n\n```svelte\n\u003c!-- template.svelte --\u003e\n\u003cscript\u003e\n  const a = 5;\n  const b = 8;\n\n  export let numbers = [];\n\u003c/script\u003e\n\n\u003cul\u003e\n  {#each numbers as number}\n    \u003cli\u003e{number}\u003c/li\u003e\n  {/each}\n\u003c/ul\u003e\n\n{#if a \u003c b}\n  \u003cp\u003ea is less than b\u003c/p\u003e\n{:else}\n  \u003cp\u003eb is less than a\u003c/p\u003e\n{/if}\n```\n\n#### Command\n\n```sh\nnpx svelte-to-html template.svelte template.html '{\"numbers\": [2, 5, 7]}'\n###                \u003cfilepath\u003e          \u003coutput\u003e     \u003cprops\u003e\n```\n\n#### Output:\n\n```html\n\u003cul\u003e\n  \u003cli\u003e2\u003c/li\u003e\n  \u003cli\u003e5\u003c/li\u003e\n  \u003cli\u003e7\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003ea is less than b\u003c/p\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidx1024%2Fsvelte-to-html","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsidx1024%2Fsvelte-to-html","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidx1024%2Fsvelte-to-html/lists"}