{"id":23170724,"url":"https://github.com/bddjr/vite-plugin-singlefile-compression","last_synced_at":"2026-01-30T08:19:27.845Z","repository":{"id":264611516,"uuid":"893831604","full_name":"bddjr/vite-plugin-singlefile-compression","owner":"bddjr","description":"📦 Compress all assets and embeds them into dist/index.html, making it convenient to share as a single HTML file.","archived":false,"fork":false,"pushed_at":"2026-01-16T03:55:04.000Z","size":1288,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-18T15:21:46.774Z","etag":null,"topics":["compress","compression","css","frontend","gzip","inline","js","plugin","sfa","singlefile","vite"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/vite-plugin-singlefile-compression","language":"TypeScript","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/bddjr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-25T09:38:15.000Z","updated_at":"2026-01-16T12:56:33.000Z","dependencies_parsed_at":"2026-01-14T18:02:47.765Z","dependency_job_id":null,"html_url":"https://github.com/bddjr/vite-plugin-singlefile-compression","commit_stats":null,"previous_names":["bddjr/vite-plugin-singlefile-compression"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/bddjr/vite-plugin-singlefile-compression","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bddjr%2Fvite-plugin-singlefile-compression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bddjr%2Fvite-plugin-singlefile-compression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bddjr%2Fvite-plugin-singlefile-compression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bddjr%2Fvite-plugin-singlefile-compression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bddjr","download_url":"https://codeload.github.com/bddjr/vite-plugin-singlefile-compression/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bddjr%2Fvite-plugin-singlefile-compression/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28909218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T08:15:08.179Z","status":"ssl_error","status_checked_at":"2026-01-30T08:14:31.507Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["compress","compression","css","frontend","gzip","inline","js","plugin","sfa","singlefile","vite"],"created_at":"2024-12-18T04:14:39.766Z","updated_at":"2026-01-30T08:19:27.839Z","avatar_url":"https://github.com/bddjr.png","language":"TypeScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Framework-agnostic Plugins"],"readme":"# vite plugin singlefile compression\n\nCompress all assets and embeds them into `dist/index.html`, making it convenient to share as a single HTML file.\n\nThe recipient can open it directly in the browser without manually unzipping the file.\n\nUsing [DecompressionStream](https://developer.mozilla.org/docs/Web/API/DecompressionStream) + [base128-ascii](https://www.npmjs.com/package/base128-ascii).\n\n## Setup\n\n```\nnpm i vite-plugin-singlefile-compression -D\n```\n\nThen modify `vite.config.ts`, see [test/vite.config.ts](test/vite.config.ts)\n\n```ts\n// Import singleFileCompression\nimport singleFileCompression from 'vite-plugin-singlefile-compression'\n\nexport default defineConfig({\n  plugins: [\n    vue(),\n    vueDevTools(),\n    // Add singleFileCompression\n    singleFileCompression(),\n  ],\n```\n\nThen modify [src/router/index.ts](test/src/router/index.ts#L5)\n\n```ts\nconst router = createRouter({\n  // Use Hash History\n  history: createWebHashHistory(),\n```\n\n## Options\n\nExample:\n\n```ts\nsingleFileCompression({\n  rename: 'example.html'\n}),\n```\n\nMore info see [src/options.ts](src/options.ts)\n\n```ts\nexport interface Options {\n    /**\n     * Rename index.html\n     */\n    rename?: string\n\n    /**\n     * https://github.com/terser/html-minifier-terser?tab=readme-ov-file#options-quick-reference\n     * @default defaultHtmlMinifierTerserOptions\n     */\n    htmlMinifierTerser?: htmlMinifierOptions | boolean\n\n    /**\n     * Try inline html used assets, if inlined or not used in JS.\n     * @default true\n     */\n    tryInlineHtmlAssets?: boolean\n\n    /**\n     * Remove inlined asset files.\n     * @default true\n     */\n    removeInlinedAssetFiles?: boolean\n\n    /**\n     * Try inline html icon, if icon is in public dir.\n     * @default true\n     */\n    tryInlineHtmlPublicIcon?: boolean\n\n    /**\n     * Remove inlined html icon files.\n     * @default true\n     */\n    removeInlinedPublicIconFiles?: boolean\n\n    /**\n     * Use Base128 to encode gzipped script.\n     * If false, use Base64.\n     * https://www.npmjs.com/package/base128-ascii\n     * @default true\n     */\n    useBase128?: boolean\n\n    /**\n     * Compress format.  \n     * https://developer.mozilla.org/en-US/docs/Web/API/DecompressionStream/DecompressionStream\n     * @type \"deflate-raw\" | \"deflate\" | \"gzip\" | \"brotli\" | \"zstd\"\n     * @default \"deflate-raw\"\n     */\n    compressFormat?: compressFormat\n\n    /**\n     * Custom compressor.\n     */\n    compressor?: compressor\n\n    /**\n     * Use import.meta polyfill.\n     * @default true\n     */\n    useImportMetaPolyfill?: boolean\n}\n```\n\n## Effect\n\nhttps://bddjr.github.io/vite-plugin-singlefile-compression/\n\n```\nvite v7.3.1 building client environment for production...\n✓ 46 modules transformed.\nrendering chunks (1)...\n\nvite-plugin-singlefile-compression 2.0.10 building...\n\n  file:///D:/code/js/vite-plugin-singlefile-compression/test/dist/index.html\n  107.149 kB -\u003e 48.323 kB\n\nFinish.\n\ndist/index.html  48.32 kB\n✓ built in 829ms\n```\n\n![](effect.jpg)\n\n## Clone\n\n```\ngit clone https://github.com/bddjr/vite-plugin-singlefile-compression\ncd vite-plugin-singlefile-compression\nnpm i\ncd test\nnpm i\ncd ..\nnode --run build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbddjr%2Fvite-plugin-singlefile-compression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbddjr%2Fvite-plugin-singlefile-compression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbddjr%2Fvite-plugin-singlefile-compression/lists"}