Registry / devops / node-minify-custom-fork

node-minify-custom-fork

JSON →
library1.0.0jsnpmunverified

An unofficial custom fork of node-minify with a minor tweak to enable uglify-js to compile ES2015/ES6 JavaScript. The original project (last stable v3.6.x) is a lightweight Node.js module for minifying JavaScript and CSS files using various compressors: Babili, YUI Compressor, Google Closure Compiler, UglifyJS2, Clean-css, CSSO, and Sqwish. Supports wildcards, file concatenation, sync/async modes, and buffer size configuration. This fork is published independently as 'node-minify-custom-fork' for those who need UglifyJS ES6 support without upstream changes.

npm install node-minify-custom-fork
INSTALL
IMPORT
SIG · NODE-MINIFY-CUSTOM
N
node-minify-custom-fork
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.

compressor
import compressor from 'node-minify';
const compressor = require('node-minify');
CJS require works in Node.js <v12; ESM import is preferred for modern projects.
minify
import { minify } from 'node-minify';
const minify = require('node-minify').minify;
Named export available for tree-shaking; default export (compressor) has minify as property.
minify options
compressor.minify({ compressor: 'uglifyjs', input: 'src.js', output: 'min.js' });
compressor.minify({ compressor: 'UglifyJS2', input: 'src.js' });
Compressor names are lowercase: 'uglifyjs', 'gcc', 'yui-js', 'babili', 'clean-css', etc. Incorrect casing fails silently.

Shows minification with UglifyJS (with ES6 support), promise usage, and file concatenation without compression using the custom fork.

// Node.js >=4.0.0, install the custom fork: npm install node-minify-custom-fork const compressor = require('node-minify-custom-fork'); // Minify a JavaScript file using UglifyJS (with ES6 support via fork) compressor.minify({ compressor: 'uglifyjs', input: 'src/app.js', output: 'dist/app.min.js', options: { /* UglifyJS options here */ }, callback: function (err, min) { if (err) throw err; console.log('Minification done: ' + min.length + ' bytes'); } }); // Using promise API compressor.minify({ compressor: 'clean-css', input: 'style.css', output: 'style.min.css' }).then(function(min) { console.log('CSS minified: ' + min.length + ' bytes'); }).catch(function(err) { console.error(err); }); // Concatenate multiple files without compression compressor.minify({ compressor: 'no-compress', input: ['file1.js', 'file2.js'], output: 'concatenated.js', callback: function (err, min) { if (err) throw err; console.log('Files concatenated'); } });
Debug
Known issues
gotchaThe custom fork 'node-minify-custom-fork' is not the official package. It may lack updates, fixes, or security patches from the upstream repository. Use at your own risk.
fix
Prefer the official 'node-minify' package if you don't need the ES6 tweak, or consider using other minifiers like 'terser' directly.
affects: >=1.0.0
deprecatedThe original node-minify project (v3.x) is in maintenance mode with no active development. Many compression backends (e.g., Babili, YUI Compressor, Google Closure Compiler via Java) are outdated or unmaintained.
fix
Migrate to modern alternatives: 'terser' for JS, 'cssnano' or 'clean-css' for CSS, or use build tools like Webpack/Rollup with built-in minifiers.
affects: <4.0.0
breakingCompressor options are backend-specific and passed verbatim. Incorrect option names or values can cause silent failures or unexpected behavior. For example, UglifyJS uses 'output' options, while GCC uses 'compilation_level'.
fix
Always consult the documentation of the specific minifier (UglifyJS, Clean-css, etc.) for valid option keys. See examples in the README.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'node-minify'
Trying to require the official package, but only the custom fork is installed.
fix
Use 'node-minify-custom-fork' in require/import statements, or install the official 'node-minify'.
TypeError: compressor.minify is not a function
Importing the package incorrectly (e.g., using named export when default export is expected).
fix
Use: const compressor = require('node-minify-custom-fork'); or import compressor from 'node-minify-custom-fork';
Error: spawn java ENOENT
Using Google Closure Compiler (gcc) compressor which requires Java runtime installed on the system.
fix
Install Java (JRE) or switch to a pure Node.js compressor like UglifyJS by setting compressor: 'uglifyjs'.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
uglify-jsrequiredUsed behind the scenes by node-minify for JavaScript minification; custom fork adjusts its configuration to support ES2015.
commanderoptionalUsed for CLI argument parsing in the original node-minify; may be a dependency of the original package.
Agent activity
2 hits · last 30 days
node
2
Resources
node-minify-custom-fork — npm install node-minify-custom-fork · libregistry