{"id":18823,"library":"static-html-bundler","title":"static-html-bundler","description":"A Node.js module that bundles and minifies CSS and JS assets referenced in HTML comment-bounded sections into single files. It reads an HTML entry point, replaces stylesheet link and script tags between user-defined start/end comment markers with a single combined and minified file per section. Version 1.0.9. No recent updates; relies on uglify-js and clean-css internally. Simpler than Webpack/Parcel but limited to comment-based bundling.","status":"active","version":"1.0.9","language":"javascript","source_language":"en","source_url":"https://github.com/mgovahi/static-html-bundler","tags":["javascript","bundle","uglify","compress","static","static html","javascript bundle","css budnle"],"install":[{"cmd":"npm install static-html-bundler","lang":"bash","label":"npm"},{"cmd":"yarn add static-html-bundler","lang":"bash","label":"yarn"},{"cmd":"pnpm add static-html-bundler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"JavaScript minification","package":"uglify-js","optional":false},{"reason":"CSS minification","package":"clean-css","optional":false}],"imports":[{"note":"CommonJS only; no ESM export. Must use local path relative to package, not bare specifier.","wrong":"import staticHtmlBundler from 'static-html-bundler';","symbol":"default","correct":"const staticHtmlBundler = require('./static-html-bundler/bundler');"},{"note":"Method attached to the default exported object; destructuring not supported.","wrong":"const { bundle } = require('static-html-bundler'); bundle(options);","symbol":"bundle","correct":"staticHtmlBundler.bundle(options);"}],"quickstart":{"code":"const staticHtmlBundler = require('./node_modules/static-html-bundler/bundler');\nconst options = {\n  sourceFolder: './src/',\n  distFolder: './dist/',\n  distJsFolder: 'js/',\n  distCssFolder: 'css/',\n  inputHtml: './src/index.html',\n  outputHtml: './dist/index.html',\n  tags: [\n    { start: '<!-- css bundle start -->', end: '<!-- css bundle end -->', type: 'css', name: 'styles' },\n    { start: '<!-- js bundle start -->', end: '<!-- js bundle end -->', type: 'js', name: 'scripts' }\n  ]\n};\nstaticHtmlBundler.bundle(options);","lang":"javascript","description":"Demonstrates running static-html-bundler with common options for CSS and JS bundling via comment markers."},"warnings":[{"fix":"Use require() style and ensure Node.js version supports CommonJS.","message":"Package only works with CommonJS require; no ESM or TypeScript support.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Verify start and end comment strings match exactly including HTML comment syntax.","message":"Requires exact comment markers in HTML; any mismatch (whitespace, typo) silently fails to bundle.","severity":"breaking","affected_versions":">=0.1"},{"fix":"Ensure distJsFolder and distCssFolder have trailing slash (e.g., 'js/' rather than 'js').","message":"Dist JS/CSS folder paths are concatenated directly; missing trailing slashes may produce incorrect output paths.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Consider using modern alternatives like Webpack, Parcel, or Vite for active maintenance.","message":"No updates since 2017; relies on outdated uglify-js and clean-css versions which may have known issues.","severity":"deprecated","affected_versions":">=1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install via npm install static-html-bundler and require with correct path: require('./node_modules/static-html-bundler/bundler') or require('static-html-bundler') is not supported; use full relative path.","cause":"Relative path incorrect or package not installed locally.","error":"Cannot find module './static-html-bundler/bundler'"},{"fix":"Use const staticHtmlBundler = require('static-html-bundler/bundler'); (note: bare specifier may not work; use relative path).","cause":"Importing with ESM syntax (import) instead of CommonJS require.","error":"TypeError: staticHtmlBundler.bundle is not a function"},{"fix":"Verify sourceFolder and inputHtml options point to existing files relative to the working directory.","cause":"Source folder or input HTML path does not exist.","error":"ENOENT: no such file or directory, open '...'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}