{"id":42045,"library":"sveltekit-html-minifier","title":"sveltekit-html-minifier","description":"A SvelteKit adapter that minifies prerendered HTML output pages using html-minifier-terser. v1.0.4 stable. It wraps any existing adapter (e.g., @sveltejs/adapter-static) and runs minification after the default adapter finishes. Only works on prerendered pages; runtime-rendered pages are not minified. Supports custom build paths and minifier options. Ships TypeScript types. Active development.","status":"active","version":"1.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/ntsd/sveltekit-html-minifier","tags":["javascript","sveltekit","svelte","html-minifier","sveltekit-adapter","typescript"],"install":[{"cmd":"npm install sveltekit-html-minifier","lang":"bash","label":"npm"},{"cmd":"yarn add sveltekit-html-minifier","lang":"bash","label":"yarn"},{"cmd":"pnpm add sveltekit-html-minifier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for SvelteKit adapter integration","package":"@sveltejs/kit","optional":false},{"reason":"Underlying minification library","package":"html-minifier-terser","optional":false}],"imports":[{"note":"Package is ESM-only; CommonJS require will fail.","wrong":"const htmlMinifierAdaptor = require('sveltekit-html-minifier')","symbol":"htmlMinifierAdaptor","correct":"import htmlMinifierAdaptor from 'sveltekit-html-minifier'"},{"note":"The default adapter is passed as the first argument to htmlMinifierAdaptor.","wrong":"","symbol":"adapter","correct":"import adapter from '@sveltejs/adapter-static'"},{"note":"Options are passed as an object literal, not imported separately.","wrong":"import { htmlMinifierOptions } from 'sveltekit-html-minifier'","symbol":"htmlMinifierOptions","correct":"import htmlMinifierAdaptor from 'sveltekit-html-minifier'; // options as second argument"}],"quickstart":{"code":"// svelte.config.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        pages: 'build',\n        minifierOptions: {\n          collapseWhitespace: true,\n          removeComments: true,\n        },\n      }\n    ),\n  },\n};","lang":"javascript","description":"Configures SvelteKit to minify prerendered HTML using adapter-static as base."},"warnings":[{"fix":"Ensure pages have `export const prerender = true;` and that prerendered output path matches the adapter's output.","message":"Only minifies prerendered HTML pages; runtime-rendered pages are not minified.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set `pages` option explicitly, e.g., for Cloudflare: `{ pages: '.svelte-kit/cloudflare' }`; for Vercel: `{ pages: '.svelte-kit/output/prerendered/pages' }`.","message":"Build path must match the adapter's output directory. Different adapters use different paths.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Place your primary adapter as the first argument; this adapter wraps and post-processes.","message":"The default adapter (first argument) is executed first; only its prerendered output is minified.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'activ':58 'adapt':7,25,34,68 'build':50 'custom':49 'default':33 'develop':59 'e.g':26 'exist':24 'finish':35 'html':3,11,16,64 'html-minifi':63 'html-minifier-ters':15 'javascript':60 'minif':30 'minifi':4,9,17,47,53,65 'option':54 'output':12 'page':13,40,44 'path':51 'prerend':10,39 'render':43 'run':29 'runtim':42 'runtime-rend':41 'ship':55 'stabl':20 'support':48 'svelt':62 'sveltejs/adapter-static':27 'sveltekit':2,6,61,67 'sveltekit-adapt':66 'sveltekit-html-minifi':1 'terser':18 'type':57 'typescript':56,69 'use':14 'v1.0.4':19 'work':37 'wrap':22","created_at":"2026-06-04T18:55:21.177028+00:00","updated_at":"2026-06-04T18:55:21.177028+00:00","problems":[{"fix":"Use `import` syntax or change your project to ESM (add `\"type\": \"module\"` to package.json).","cause":"Using CommonJS `require()` with an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Ensure page has `export const prerender = true;` and the `pages` option matches your adapter's output folder.","cause":"Page is not prerendered or output path is incorrect.","error":"HTML not minified"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ntsd/sveltekit-html-minifier#readme","github":"https://github.com/ntsd/sveltekit-html-minifier","docs":null,"changelog":null,"pypi":null,"npm":"sveltekit-html-minifier","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}