Registry / devops / cutw-minimal

cutw-minimal

JSON →
library1.2.4jsnpmunverified

A simple command-line HTML minifier from CleanUptheWeb. Current stable version is 1.2.4. It can be used both as a CLI tool and as a Node.js module via require(). The CLI works on a directory basis, with input and output directory arguments. The library is minimal and provides a single min() method that accepts a string of HTML and returns minified output. It is designed for simple use cases where full-featured minifiers are overkill, but lacks advanced features like source maps or streaming.

npm install cutw-minimal
INSTALL
IMPORT
SIG · CUTW-MINIMAL
C
cutw-minimal
devopsjavascriptv1.2.4
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.

cutw-minimal
const Minifier = require('cutw-minimal');
import Minifier from 'cutw-minimal';
This package does not ship ESM exports. Only CommonJS require() is supported. Using ES import will either fail or require a default import interop.
Minifier
const m = new Minifier(); m.min(htmlString);
Minifier.min(htmlString);
The minifier is instantiated via the constructor. Calling .min directly on the class will cause a TypeError.
min
const m = new Minifier(); console.log(m.min('<p> Hello </p>'));
const { min } = require('cutw-minimal'); min(htmlString);
There is no named export of min; it must be called on an instance.

This example shows how to import the package using CommonJS require, create a new instance, and minify an HTML string.

const Minifier = require('cutw-minimal'); const minifier = new Minifier(); const html = '<html> <head> <title>Test</title> </head> <body> <p>Hello World</p> </body></html>'; const result = minifier.min(html); console.log(result); // Output: <html><head><title>Test</title></head><body><p>Hello World</p></body></html>
Debug
Known issues
gotchaESM import not supported
fix
Use CommonJS require() instead of ES import syntax.
affects: all
deprecatedThe CLI argument parsing is brittle; it assumes input/output directories with no flags.
fix
Consider using a more robust CLI tool like html-minifier. For programmatic use, the API is fine.
affects: all
gotchaMinifier() constructor requires no arguments. Calling new Minifier(options) will silently ignore options.
fix
Do not pass options to the constructor; they are not supported.
affects: all
gotchamin() method throws on invalid input (e.g., undefined or null).
fix
Always provide a non-null string to min()
affects: all
Errors
Common errors & fixes
TypeError: Minifier is not a constructor
Using ES import (import Minifier from 'cutw-minimal') instead of CommonJS require
fix
Change to const Minifier = require('cutw-minimal');
TypeError: m.min is not a function
Calling min on the class without instantiating
fix
Create an instance first: const m = new Minifier(); then m.min(html)
Cannot find module 'cutw-minimal'
Package not installed or running in a non-Node environment
fix
Install with npm install cutw-minimal
Upgrade
Version history
1.2.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
cutw-minimal — npm install cutw-minimal · libregistry