# postcss-values-parser

> A CSS property value parser for use with PostCSS

Latest version **8.0.0** (published 2026-05-18) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install postcss-values-parser
pnpm add postcss-values-parser
yarn add postcss-values-parser
bun add postcss-values-parser
```

## Health

**Score 50/100 (C)** — status: active.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 8.0.0 |
| Published | 2026-05-18 |
| First published | 2016-03-28 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | ESM |
| Node | >=22.0.0 |
| Dependencies | 4 |
| Unpacked size | 66 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Andrew Powell (shellscape) |
| Maintainers | shellscape |
| Keywords | css, less, ast, postcss, value, values, parser, parsing, properties |

## Links

- npm: https://www.npmjs.com/package/postcss-values-parser
- Repository: shellscape/postcss-values-parser
- Homepage: https://github.com/shellscape/postcss-values-parser
- Issues: https://github.com/shellscape/postcss-values-parser/issues
- npm.io page: https://npm.io/package/postcss-values-parser

## Dependencies (4)

- [css-tree](https://npm.io/package/css-tree.md) ^3.1.0
- [color-name](https://npm.io/package/color-name.md) ^1.1.4
- [is-url-superb](https://npm.io/package/is-url-superb.md) ^4.0.0
- [quote-unquote](https://npm.io/package/quote-unquote.md) ^1.0.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 8.0.0 (latest) — 2026-05-18
- 7.0.1 (last) — 2026-05-18
- 3.0.0-beta.4 (next) — 2019-02-10
- 7.0.0 — 2025-07-10
- 6.0.2 — 2022-01-07
- 6.0.1 — 2021-10-09
- 6.0.0 — 2021-07-27
- 5.0.0 — 2021-02-22
- 4.0.0 — 2020-09-16
- 3.2.1 — 2020-04-26
- 3.2.0 — 2020-04-19
- 3.1.1 — 2020-02-07
- 3.1.0 — 2020-02-04
- 3.0.5 — 2019-06-26
- 3.0.4 — 2019-05-04
- … 31 more at https://npm.io/package/postcss-values-parser/versions

## README

[actions]: https://github.com/shellscape/postcss-values-parser/actions/workflows/validate.yml/badge.svg?branch=master
[actions-url]: https://github.com/shellscape/postcss-values-parser/actions/workflows/validate.yml
[size]: https://packagephobia.now.sh/badge?p=postcss-values-parser
[size-url]: https://packagephobia.now.sh/result?p=postcss-values-parser

<div align="center">
  <img width="95" height="95" title="Philosopher’s stone, logo of PostCSS" src="http://postcss.github.io/postcss/logo.svg"><br/><br/>
</div>

# postcss-values-parser [![actions][actions]][actions-url] [![size][size]][size-url]

A CSS property value parser that uses [css-tree](https://github.com/csstree/csstree) for parsing,
and models nodes on top of PostCSS’s `Node`/`Container`/`Root` classes so the API feels familiar to PostCSS users.

This package powers part of [Prettier](https://prettier.io/). Please consider becoming a sponsor if you find this package useful or are a Prettier user. https://github.com/sponsors/shellscape

## Install

Using npm:

```console
npm install postcss-values-parser --save-dev
```

## Requirements

- Node.js >= 20.19.0
- PostCSS >= 8.4.14 (peer dependency)

Note: This package is ESM‑only. Use `import` in Node.js. In CommonJS on Node >= 20.19.0, `require()` can load ES modules:

```js
// CommonJS (Node >= 20.19.0)
const { parse } = require('postcss-values-parser');
```

## Benefits

- Uses css-tree for fast, standards‑compliant parsing
- Builds PostCSS‑style nodes for a familiar API
- Doesn't strip characters; e.g., parentheses are preserved in the AST
- Full [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) traversal
- Optional walker helpers (`registerWalkers(Container)`) to walk by node type
- Convenience methods to stringify nodes
- Provides convenience properties for number units, colors, etc.

## Usage

Please see the [Documentation](./docs/README.md) for general use and further information on using the package.

## Meta

[CONTRIBUTING](./.github/CONTRIBUTING.md)

[LICENSE (Mozilla Public License)](./LICENSE)

---
_Source: https://npm.io/package/postcss-values-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
