{"id":21486913,"url":"https://github.com/ntsd/sveltekit-html-minifier","last_synced_at":"2025-10-30T21:11:45.331Z","repository":{"id":185654532,"uuid":"673730216","full_name":"ntsd/sveltekit-html-minifier","owner":"ntsd","description":"Sveltekit Adapter to Minify the preload HTML page","archived":false,"fork":false,"pushed_at":"2024-10-25T06:14:05.000Z","size":95,"stargazers_count":5,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-26T17:44:33.258Z","etag":null,"topics":["hacktoberfest","html-minifier","svelte","sveltekit","sveltekit-adapter"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/sveltekit-html-minifier","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/ntsd.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}},"created_at":"2023-08-02T09:42:17.000Z","updated_at":"2024-10-25T06:14:09.000Z","dependencies_parsed_at":"2024-02-17T19:45:10.912Z","dependency_job_id":null,"html_url":"https://github.com/ntsd/sveltekit-html-minifier","commit_stats":null,"previous_names":["ntsd/sveltekit-html-minifier"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntsd%2Fsveltekit-html-minifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntsd%2Fsveltekit-html-minifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntsd%2Fsveltekit-html-minifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntsd%2Fsveltekit-html-minifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ntsd","download_url":"https://codeload.github.com/ntsd/sveltekit-html-minifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226047112,"owners_count":17565293,"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":["hacktoberfest","html-minifier","svelte","sveltekit","sveltekit-adapter"],"created_at":"2024-11-23T13:24:45.842Z","updated_at":"2025-10-30T21:11:40.277Z","avatar_url":"https://github.com/ntsd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sveltekit HTML Minifier\n\n![NPM Version](https://img.shields.io/npm/v/sveltekit-html-minifier) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ntsd/sveltekit-html-minifier/test.yaml)\n\nSveltekit Adapter to Minify the preload HTML page in case using CSR/Preload by [html-minifier-terser](https://github.com/terser/html-minifier-terser).\n\n\u003e [!WARNING]  \n\u003e This adaptor will only minify from the `prerendered` HTML output path, If the page is rendering on runtime it will not minify.\n\nFor SSR minify @leoj3n had share a solution here https://github.com/ntsd/sveltekit-html-minifier/issues/5\n\n## Installation\n\n`npm i -D sveltekit-html-minifier`\n\n## Usage\n\nAdd the adapter to your `svelte.config.js` file. Place your default adapter as the first parameter. This will run after the default adapter has finished rendering.\n\n```js\nimport adapter from \"@sveltejs/adapter-static\";\nimport htmlMinifierAdaptor from \"sveltekit-html-minifier\";\n\nexport default {\n  kit: {\n    adapter: htmlMinifierAdaptor(adapter()),\n  },\n};\n```\n\nMake sure that the page you want to minify have [`export const prerender = true;`](https://kit.svelte.dev/docs/page-options#prerender) flag set and the output path is correct for the adaptor, otherwise it will not minify.\n\n### Options\n\nYou can pass additional options to the adapter. For example\n\n```js\nimport adapter from \"@sveltejs/adapter-static\";\nimport htmlMinifierAdaptor from \"sveltekit-html-minifier\";\n\nexport default {\n  kit: {\n    adapter: htmlMinifierAdaptor(\n      adapter({\n        pages: \"build\",\n      }),\n      {\n        // your build path (same as adapter static pages)\n        pages: \"build\",\n        // custom html-minifier-terser options\n        // https://github.com/terser/html-minifier-terser#options-quick-reference\n        minifierOptions: {},\n      }\n    ),\n  },\n};\n```\n\n- `pages` (string): Specifies the build path. This should be the same as the adapter static pages.\n- `minifierOptions` (object): Custom options for [html-minifier-terser](https://github.com/terser/html-minifier-terser#options-quick-reference).\n\nfor other adaptor, you probably need to specify the HTML output path:\n\n`@sveltejs/adapter-cloudflare`\n\n```js\nhtmlMinifierAdaptor(adapter(), { pages: \".svelte-kit/cloudflare\" })\n```\n\n`@sveltejs/adapter-vercel`\n\n```js\nhtmlMinifierAdaptor(adapter(), { pages: \".svelte-kit/output/prerendered/pages\" })\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntsd%2Fsveltekit-html-minifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fntsd%2Fsveltekit-html-minifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntsd%2Fsveltekit-html-minifier/lists"}