Registry / devops / css-format

css-format

JSON →
library1.0.0jsnpmunverified

A minimal CSS parser and formatter that beautifies minified or messy CSS by adding proper indentation and line breaks. Version 1.0.0, released in 2016 with no updates since. It uses simple regex-based parsing, not a full AST, so it may not handle all CSS constructs correctly (e.g., nested rules, custom properties). Alternative to more robust tools like Prettier, but lightweight for simple formatting tasks.

npm install css-format
INSTALL
IMPORT
SIG · CSS-FORMAT
C
css-format
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.

default
const format = require('css-format');
import format from 'css-format';
Package is CommonJS-only, no named exports.

Shows basic usage: format minified CSS string into expanded, indented output.

const format = require('css-format'); const code = `@media screen{div.test{color: "red";}}`; console.log(format(code)); // Output: // @media screen { // div.test { // color: "red"; // } // }
Debug
Known issues
gotchaIncorrect handling of CSS custom properties (var(--foo)) or complex selectors with commas.
fix
Use a more robust formatter like Prettier or stylefmt if you need full CSS spec support.
affects: >=1.0.0
gotchaFormatting may break if CSS contains malformed or non-standard syntax.
fix
Ensure CSS input is valid before formatting.
affects: >=1.0.0
deprecatedNo updates since 2016. Package is effectively abandoned.
fix
Consider migrating to an actively maintained alternative like Prettier.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'css-format'
Package not installed or not in node_modules.
fix
Run `npm install css-format` in your project directory.
format is not a function
Importing incorrectly using ES module syntax, but package is CommonJS.
fix
Use `const format = require('css-format');` instead of `import`.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
css-format — npm install css-format · libregistry