{"id":29020783,"url":"https://github.com/uhteddy/svelte-bundle","last_synced_at":"2026-03-03T21:08:21.817Z","repository":{"id":259309878,"uuid":"877548717","full_name":"uhteddy/svelte-bundle","owner":"uhteddy","description":"CLI tool to easily bundle a .svelte file into a single .html file","archived":false,"fork":false,"pushed_at":"2026-03-03T19:52:50.000Z","size":210,"stargazers_count":41,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-03T19:56:07.447Z","etag":null,"topics":["bundle","html","svelte"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uhteddy.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-10-23T20:56:43.000Z","updated_at":"2026-03-03T19:52:14.000Z","dependencies_parsed_at":"2025-06-26T01:38:56.077Z","dependency_job_id":"5a2481be-a7d9-4662-a71d-e022fec9c0de","html_url":"https://github.com/uhteddy/svelte-bundle","commit_stats":null,"previous_names":["uhteddy/svelte-bundle"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/uhteddy/svelte-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhteddy%2Fsvelte-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhteddy%2Fsvelte-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhteddy%2Fsvelte-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhteddy%2Fsvelte-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uhteddy","download_url":"https://codeload.github.com/uhteddy/svelte-bundle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhteddy%2Fsvelte-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30060993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"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":["bundle","html","svelte"],"created_at":"2025-06-26T01:38:33.941Z","updated_at":"2026-03-03T21:08:21.810Z","avatar_url":"https://github.com/uhteddy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e ⚠️ **NOTICE:** While this tool is currently functional, it has not nearly been battle-tested enough to ensure it works in most use-cases.\n\n![svelte-bundle](https://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcwfyh1w8r8g4f2ap1hff.png)\n\n## Usage\n```bash\nsvelte-bundle create my-app\ncd my-app\nsvelte-bundle build\n```\n\n### Full Documentation: [https://github.com/uhteddy/svelte-bundle/wiki](https://github.com/uhteddy/svelte-bundle/wiki)\n\n# Svelte Bundle CLI\n\n**Svelte Bundle CLI** is a command-line tool that scaffolds a Svelte 5 + Vite project and bundles it into a single self-contained `.html` file. The goal of this tool is to make it easy to develop with Svelte and deploy anywhere — particularly for cases where everything needs to be contained in a single file.\n\nJust note, the purpose of this tool is **NOT** to bundle an entire large-scale Svelte app. The purpose is to expand the capabilities of Svelte to work on systems like certain Content Management Systems (CMS) that only allow HTML, CSS, and JS. It was also built with SSR hydration support so the generated file is SEO-safe, with necessary elements already pre-rendered.\n\nUtilizing this you will be able to develop a page with the joy of Svelte — components, reactivity, TypeScript, Tailwind — and output a single `.html` file you can drop anywhere.\n\n⚠️ **Note**: This tool is **NOT** made to function with SvelteKit natively. It scaffolds a standalone Svelte 5 app (not a SvelteKit project) and outputs a single `.html` file.\n\n## Inspiration\nThis tool was inspired by the need I had when it came to updating the CMS for a company I worked for. They were looking for more custom content on their website which used an outdated CMS. Pages were only able to include HTML, CSS, and JS.\n\nPure HTML, CSS, and JS can be granular and more importantly, lacks the reactivity that Svelte has. Meaning, to develop certain features I had to focus a lot more on the \"what to do\" when data changes, rather than Svelte handling that for me.\n\nSo, I searched for tools around that could be of assistance. I found [figsvelte](https://github.com/thomas-lowry/figsvelte) which was of so much help in the underlying understanding of what to do. But, it did not accomplish all I was looking for. I needed a solution that didn't just generate an HTML file with JS that hydrated the page. Through a lot of tinkering I was finally able to get the system to work.\n\nI noticed through a lot of Google searches I wasn't the only one looking for a solution like this, yet I was unable to find one that addressed everything I was looking for. So, for this reason I built svelte-bundle to take care of this in a much more simplistic and CLI-driven way.\n\n## Installation\n\n```bash\nnpm install -g svelte-bundle\n# or\nbun add -g svelte-bundle\n```\n\n`sb` is available as a short alias:\n\n```bash\nsb create my-app\nsb build --hydrate\n```\n\n---\n\n## `svelte-bundle create`\n\nScaffolds a new Vite + Svelte 5 project with TypeScript configured and ready to go.\n\n```bash\nsvelte-bundle create my-app\n```\n\nInteractive prompts will ask for:\n- **Package manager** — bun, npm, pnpm, or yarn\n- **Optional features** — Tailwind CSS, ESLint, Prettier, Vitest\n- **Git** — initialize a repository\n- **Install** — run the package manager automatically\n\n| Flag | Description |\n|---|---|\n| `--template / -t` | Template to use (currently: `default`) |\n| `--pm` | Skip the package manager prompt (`bun`, `npm`, `pnpm`, `yarn`) |\n| `--no-install` | Skip dependency installation |\n| `--no-git` | Skip git initialization |\n\n```bash\nsvelte-bundle create my-app --pm bun --no-git\n```\n\n### Project structure\n\n```\nmy-app/\n├── src/\n│   ├── App.svelte       ← root component\n│   ├── main.ts          ← entry point\n│   └── lib/\n│       └── index.ts     ← library re-export entry\n├── public/\n├── index.html\n├── vite.config.ts\n├── tsconfig.json\n└── package.json\n```\n\n### Dev server\n\n```bash\ncd my-app\nnpm run dev\n```\n\n---\n\n## `svelte-bundle build`\n\nBuilds the project into a **single self-contained `dist/index.html`** with all CSS and JavaScript inlined — no separate asset files, no web server needed.\n\n```bash\ncd my-app\nsvelte-bundle build\n```\n\n| Flag | Default | Description |\n|---|---|---|\n| `--hydrate` | `false` | Pre-render with Svelte SSR for SEO-friendly output |\n| `--entry` | `src/App.svelte` | Root component for SSR pre-rendering |\n| `--outfile` | `dist/index.html` | Output file path |\n| `--mode / -m` | `production` | Vite build mode |\n\n### Default build\n\n```bash\nsvelte-bundle build\n```\n\nProduces a single `dist/index.html` with CSS and JS fully inlined. Open it directly in a browser — no web server required. Drop it into any CMS, email, or embedded environment.\n\n### Hydrated build (SSR)\n\n```bash\nsvelte-bundle build --hydrate\n```\n\nPre-renders the root component server-side so the page contains real HTML content before JavaScript executes. Useful for:\n\n- **SEO** — search engine crawlers see actual content immediately\n- **LCP** — Largest Contentful Paint is not blocked by JS execution\n- **CMS / embedded use** — a fully pre-rendered, static single file\n\nThe client JS automatically detects whether SSR content is present and calls `hydrate()` or `mount()` accordingly — no separate builds or entry points needed.\n\n### How the build pipeline works\n\n1. **Client bundle** — `vite build` compiles and minifies the Svelte app via your `vite.config.ts`\n2. **Inline** — every `\u003clink rel=\"stylesheet\"\u003e` becomes an inline `\u003cstyle\u003e` block; every `\u003cscript src=\"...\"\u003e` becomes an inline `\u003cscript type=\"module\"\u003e` block\n3. **SSR** *(with `--hydrate` only)* — a temporary Vite SSR build server-renders the component; the HTML is injected into `\u003cdiv id=\"app\"\u003e` before inlining; all temp files are cleaned up automatically\n\n---\n\n## Features\n- [x] Scaffold a Svelte 5 + Vite project with a single command\n- [x] Outputs a single `.html` file ready for deployment anywhere\n- [x] All CSS and JS fully inlined — zero external dependencies at runtime\n- [x] SSR hydration support for SEO-safe output\n- [x] Tailwind CSS support out of the box (selected during `create`)\n- [x] Optional ESLint, Prettier, and Vitest setup\n- [x] TypeScript everywhere, strict mode enforced\n- [x] Works with any Vite plugin ecosystem\n\n## Requirements\n\n- Node.js 18+ or Bun 1.0+\n- Projects created with `svelte-bundle create` include Vite 6 and Svelte 5 as devDependencies\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuhteddy%2Fsvelte-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuhteddy%2Fsvelte-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuhteddy%2Fsvelte-bundle/lists"}