Registry / devops / hypercrush

hypercrush

JSON →
library1.0.21jsnpmunverified

HyperCrush (v1.0.21) is a Node.js module for aggressively minifying HTML and SVG markup beyond standard minifiers. It removes leading zeros from decimals, strips unnecessary quotes from attribute values, eliminates whitespace between tags and attributes, and compresses SVG for inline DOM usage. Designed as a Gulp plugin or standalone tool, it complements html-minifier and terser. Unlike general-purpose minifiers, HyperCrush focuses on edge-case savings (e.g., `0.5` → `.5`). Maintained on GitHub but infrequently updated.

npm install hypercrush
INSTALL
IMPORT
SIG · HYPERCRUSH
H
hypercrush
devopsjavascriptv1.0.21
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.

hypercrush
import hypercrush from 'hypercrush'
const hypercrush = require('hypercrush')
Package is ESM-only; CJS require will fail. Use import syntax.

Shows Gulp integration for HTML minification (using html-minifier then HyperCrush 'all' mode) and SVG crushing with 'svg' mode.

import hypercrush from 'hypercrush'; import gulp from 'gulp'; import htmlmin from 'gulp-htmlmin'; gulp.task('crush-html', function() { return gulp.src('./src/*.html') .pipe(htmlmin({ collapseWhitespace: true })) .pipe(hypercrush('all')) .pipe(gulp.dest('./dist')); }); gulp.task('crush-svg', function() { return gulp.src('./src/*.svg') .pipe(hypercrush('svg')) .pipe(gulp.dest('./dist')); });
Debug
Known issues
gotchaWhitespace between tags is collapsed; cannot rely on it for CSS styling (e.g., `inline-block` gaps).
fix
Use explicit spacing or CSS flexbox/grid instead of relying on whitespace.
affects: >=1.0.0
gotchaSVG mode produces markup suitable only for inline DOM embedding; does NOT produce valid standalone SVG files (IMG tags or direct file usage will break).
fix
Do NOT use 'svg' mode for files loaded via <img src=...> or as standalone SVG. Only use for inline SVG in HTML.
affects: >=1.0.0
deprecatedPackage uses `-S` flag in install command; modern npm defaults to saving dependency — `npm install hypercrush` is sufficient.
fix
Run `npm install hypercrush` without `-S`.
affects: >=1.0.0
gotchaDefault mode removes leading zero from decimals in attributes (`data-val="0.2"` → `data-val=.2`), which may break strict parsers or custom processing expecting numeric values with leading zero.
fix
If leading zeros are required, avoid using default/all mode, or post-process to re-add zeros.
affects: >=1.0.0
gotchaAttribute quote stripping may break if attribute values contain spaces or special characters (e.g., `class="foo bar"` stays quoted, but `class=foo bar` would be invalid). However, the library does not handle all edge cases.
fix
Test output thoroughly; ensure attribute values don't contain spaces, reserved characters, or URL fragments that require quotes.
affects: >=1.0.0
Errors
Common errors & fixes
require() of ES Module /path/to/hypercrush/index.js from /path/to/your/file.js not supported.
Attempting to use `require('hypercrush')` in a CommonJS file.
fix
Convert your file to ESM (use `import` or rename to `.mjs`) or use dynamic import: `const hypercrush = (await import('hypercrush')).default;`
hypercrush is not a function
Importing the module incorrectly (e.g., `import { hypercrush } from 'hypercrush'` instead of default import).
fix
Use default import: `import hypercrush from 'hypercrush'`
TypeError: hypercrush is not a function
Calling the imported function without arguments when Gulp expects a function that returns a stream (used outside Gulp pipeline).
fix
Use it as a Gulp plugin: `.pipe(hypercrush())` or call with mode: `hypercrush('all')` inside a pipeline.
Upgrade
Version history
1.0.21latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
hypercrush — npm install hypercrush · libregistry