Registry / devops / builder-html-minifier

builder-html-minifier

JSON →
library1.0.0jsnpmunverified

HTML minifier plugin for component-builder2.js. Version 1.0.0 is the current stable release, last updated in 2014. This package integrates html-minifier into the component-builder2 build pipeline to minify HTML templates. It requires component-builder2 as a peer dependency and wraps html-minifier. Key differentiator: designed specifically for the component-builder2 ecosystem, but has no default options — minification only occurs if options are passed.

npm install builder-html-minifier
INSTALL
IMPORT
SIG · BUILDER-HTML-MINIF
B
builder-html-minifier
devopsjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default export
✓ var minifier = require('builder-html-minifier');
✗ var minifier = require('builder-html-minifier').default;
CommonJS only — no ESM support. Package exports a single function.
require with alternative styles
✓ import minifier from 'builder-html-minifier';
✗ import { minifier } from 'builder-html-minifier';
If using ESM, the default import works as the module has a default export. However, the package is CJS only, so this import may cause issues in pure ESM environments.
dynamic require
✓ const minifier = require('builder-html-minifier');
✗ const minifier = require('builder-html-minifier').minifier;
Accessing a property 'minifier' from the required module is incorrect — the module exports the function directly.

Sets up component-builder2 to minify HTML templates with recommended options.

var build = require('component-builder2'); var minifier = require('builder-html-minifier'); var options = { collapseWhitespace: true, collapseBooleanAttributes: true, removeEmptyAttributes: true, removeOptionalTags: true }; build.scripts(branches, options) .use('templates', build.plugins.string(), minifier(options)) .pipe(process.stdout);
Debug
Known issues
gotchaNo default options — if you don't pass any options, no minification occurs.
fix
Always pass at least the recommended minifierOptions object to the minifier function.
affects: >=1.0.0
deprecatedPackage is effectively deprecated — no updates since 2014, component-builder2 is also unmaintained.
fix
Consider using a modern build tool like webpack with html-loader or html-minifier directly.
affects: >=1.0.0
gotchaRequires component-builder2 as a peer dependency; using without it will cause runtime errors.
fix
Ensure component-builder2 is installed and required before using this plugin.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'component-builder2'
Missing peer dependency component-builder2.
fix
Run 'npm install component-builder2'.
TypeError: minifier is not a function
Incorrect import — may have used a named import instead of default.
fix
Use 'var minifier = require('builder-html-minifier');' without destructuring.
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'scripts' of undefined
build object not correctly initialized from component-builder2.
fix
Ensure you call 'require('component-builder2')' and pass the correct 'branches' and 'options' to build.scripts().
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
component-builder2requiredpeer dependency — the plugin is designed to work within component-builder2's build pipeline
Agent activity
5 hits · last 30 days
node
4
Resources
builder-html-minifier — npm install builder-html-minifier · libregistry