css-stringify
raw JSON → 2.0.0 verified Fri May 01 auth: no javascript maintenance
A JavaScript CSS stringifier for Node.js, part of the Rework CSS ecosystem. It takes an AST produced by css-parse and converts it back to a CSS string. Version 2.0.0 is the latest stable release, compatible with Node.js. Typically used internally via the `css` package. Not actively developed, but stable for legacy projects.
Common errors
error TypeError: stringify is not a function ↓
cause Using default import instead of named import.
fix
import { stringify } from 'css-stringify';
Warnings
gotcha Package is deprecated in favor of the combined 'css' package. Direct usage is uncommon. ↓
fix Use the 'css' package which re-exports stringify: import { stringify } from 'css';
Install
npm install css-stringify yarn add css-stringify pnpm add css-stringify Imports
- stringify wrong
import stringify from 'css-stringify';correctimport { stringify } from 'css-stringify';
Quickstart
import { stringify } from 'css-stringify';
import { parse } from 'css-parse';
const css = 'body { color: red; }';
const ast = parse(css);
const output = stringify(ast);
console.log(output); // prints: body { color: red; }