Registry / devops / static-html-bundler

static-html-bundler

JSON →
library1.0.9jsnpmunverified

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.

npm install static-html-bundler
INSTALL
IMPORT
SIG · STATIC-HTML-BUNDLE
S
static-html-bundler
devopsjavascriptv1.0.9
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const staticHtmlBundler = require('./static-html-bundler/bundler');
import staticHtmlBundler from 'static-html-bundler';
CommonJS only; no ESM export. Must use local path relative to package, not bare specifier.
bundle
staticHtmlBundler.bundle(options);
const { bundle } = require('static-html-bundler'); bundle(options);
Method attached to the default exported object; destructuring not supported.

Demonstrates running static-html-bundler with common options for CSS and JS bundling via comment markers.

const staticHtmlBundler = require('./node_modules/static-html-bundler/bundler'); const options = { sourceFolder: './src/', distFolder: './dist/', distJsFolder: 'js/', distCssFolder: 'css/', inputHtml: './src/index.html', outputHtml: './dist/index.html', tags: [ { start: '<!-- css bundle start -->', end: '<!-- css bundle end -->', type: 'css', name: 'styles' }, { start: '<!-- js bundle start -->', end: '<!-- js bundle end -->', type: 'js', name: 'scripts' } ] }; staticHtmlBundler.bundle(options);
Debug
Known issues
gotchaPackage only works with CommonJS require; no ESM or TypeScript support.
fix
Use require() style and ensure Node.js version supports CommonJS.
affects: >=1.0
breakingRequires exact comment markers in HTML; any mismatch (whitespace, typo) silently fails to bundle.
fix
Verify start and end comment strings match exactly including HTML comment syntax.
affects: >=0.1
gotchaDist JS/CSS folder paths are concatenated directly; missing trailing slashes may produce incorrect output paths.
fix
Ensure distJsFolder and distCssFolder have trailing slash (e.g., 'js/' rather than 'js').
affects: >=1.0
deprecatedNo updates since 2017; relies on outdated uglify-js and clean-css versions which may have known issues.
fix
Consider using modern alternatives like Webpack, Parcel, or Vite for active maintenance.
affects: >=1.0
Errors
Common errors & fixes
Cannot find module './static-html-bundler/bundler'
Relative path incorrect or package not installed locally.
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.
TypeError: staticHtmlBundler.bundle is not a function
Importing with ESM syntax (import) instead of CommonJS require.
fix
Use const staticHtmlBundler = require('static-html-bundler/bundler'); (note: bare specifier may not work; use relative path).
ENOENT: no such file or directory, open '...'
Source folder or input HTML path does not exist.
fix
Verify sourceFolder and inputHtml options point to existing files relative to the working directory.
Upgrade
Version history
1.0.9latest on npm
Audit
Dependencies
uglify-jsrequiredJavaScript minification
clean-cssrequiredCSS minification
Agent activity
13 hits · last 30 days
node
10
OpenAI (training)
2
Resources