Registry / devops / cssmin-cli

cssmin-cli

JSON →
library0.0.5jsnpmunverified

A command-line tool and library for minifying CSS files, based on a JavaScript port of YUICompressor. This package is a fork of jbleuzen/node-cssmin that adds the ability to output the minified CSS to a file from the CLI. Version 0.0.5, last updated in 2016. It has no active maintenance and is largely superseded by more modern CSS minifiers like cssnano or clean-css. Works in Node.js only.

npm install cssmin-cli
INSTALL
IMPORT
SIG · CSSMIN-CLI
C
cssmin-cli
devopsjavascriptv0.0.5
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.

cssmin
import cssmin from 'cssmin'
const cssmin = require('cssmin')
The package only supports CommonJS require. No named export.
default function
const cssmin = require('cssmin')
import { cssmin } from 'cssmin'
The package is CJS-only; named imports in ESM will fail.

Shows how to require the module, read a CSS file, minify it, and write the result to a new file.

const cssmin = require('cssmin'); const fs = require('fs'); const input = fs.readFileSync('input.css', 'utf8'); const minified = cssmin(input, 10000); fs.writeFileSync('output.css', minified, 'utf8'); console.log('CSS minified successfully');
Debug
Known issues
deprecatedPackage is unmaintained and uses an old YUICompressor port. Modern alternatives (cssnano, clean-css) are faster and more reliable.
fix
Switch to a maintained CSS minifier like cssnano or clean-css.
affects: all
gotchaThe output is one long line if linebreakpos is not specified; large files may cause memory issues.
fix
Provide a reasonable linebreakpos (e.g., 8000) to avoid extremely long lines.
affects: all
gotchaThe function takes CSS as a string, not a file path. Passing a file path will not work.
fix
Read the file first using fs.readFileSync or fs.readFile.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'cssmin'
The package is installed globally but not locally, or not installed at all.
fix
Run 'npm install cssmin' in your project directory.
ReferenceError: require is not defined
Running the code in an ESM context without using createRequire.
fix
Use dynamic import or switch to CommonJS with '.cjs' extension.
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
cssmin-cli — npm install cssmin-cli · libregistry