Registry / devops / kd-minifier

kd-minifier

JSON →
library1.0.8jsnpmunverified

kd-minifier is a modified fork of the original minifier package (v1.0.8) for minifying CSS and JS files. It provides a CLI tool and Node.js API for minification, CSS URL resolution relative to output, and automatic @import resolution. Release cadence is unknown; the fork appears unmaintained. Compared to alternatives like UglifyJS or clean-css, it offers a simpler setup with folder-wide minification and template-based output naming.

npm install kd-minifier
INSTALL
IMPORT
SIG · KD-MINIFIER
K
kd-minifier
devopsjavascriptv1.0.8
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.

kd-minifier
const minifier = require('kd-minifier')
import minifier from 'kd-minifier'
This package does not support ESM; use CommonJS require().
minifier.on
minifier.on('error', callback)
minifier.on('error', undefined)
Event listener must be set before calling minify.
minifier.minify
minifier.minify(input, options)
minifier.minify({input: input, options: options})
First argument is a path string or array of paths, second is options object.
minifier.generateOutputName
minifier.generateOutputName(file, { template: '...', content: null })
minifier.generateOutputName(file, 'template')
Second argument must be an options object, not a string.

Demonstrates how to use kd-minifier to minify a single JS file and a folder of files with template-based output naming.

const minifier = require('kd-minifier'); const path = require('path'); // Minify a single file const input = './src/script.js'; const output = './dist/script.min.js'; minifier.on('error', (err) => { console.error('Minification error:', err); }); minifier.minify(input, { output }); // Minify a folder with template minifier.minify('./src', { template: '{{filename}}-{{md5}}.min.{{ext}}', clean: false });
Debug
Known issues
deprecatedPackage is a forked, unmaintained version of the original minifier.
fix
Consider using uglify-js and clean-css directly, or switch to an active minification tool.
affects: >=1.0.0
gotchaThe 'minifier' global from the original package is replaced by 'kd-minifier'. Do not use require('minifier').
fix
Use require('kd-minifier') instead.
affects: >=1.0.0
gotchaThe package does not provide TypeScript type definitions.
fix
Create your own declaration file or use @ts-ignore.
affects: >=1.0.0
gotchaCSS @import resolution may fail if the imported file does not exist or paths are incorrect.
fix
Ensure all @import paths are relative to the CSS file location.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'minifier'
Using wrong package name 'minifier' instead of 'kd-minifier'
fix
npm install kd-minifier and require('kd-minifier')
TypeError: minifier.on is not a function
Calling .on before the module is fully loaded or using wrong import syntax
fix
Ensure require('kd-minifier') is used and the module is loaded correctly.
Error: ENOENT: no such file or directory, open '...'
Input file path does not exist
fix
Verify the input path is correct and the file exists.
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies
uglify-jsrequiredUsed internally for JS minification
clean-cssrequiredUsed internally for CSS minification
Agent activity
2 hits · last 30 days
node
2
Resources
kd-minifier — npm install kd-minifier · libregistry