Back to Explore

postcss/postcss-value-parser

GitHub
2 watchersOpen source

Last release:

postcss-value-parser parses CSS declaration values and at-rule parameters into a tree of nodes, with a traversal API for walking and transforming parts of the value (for example, converting specific functions like rgba()). It also provides methods to stringify the parsed tree back into a CSS value.

Project status

  • Maintenance status: The repository shows an upstream GitHub push on 2026-06-05, but the last provided published update (v4.2.0) is from 2021-11-29, so tagged updates appear infrequent, with evidence of recent activity but no recent release-level changes shown here.
  • Update cadence: After v4.2.0 (2021), the next activity evidenced is only the 2026-06-05 upstream push, with no additional versioned updates in the provided list, suggesting a long gap between released updates.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v4.2.0

    v4.2.0 adds the ability to report an end position for parsed nodes. The release notes mention this as a new feature, and the code implements it by adding a new index field across the TypeScript types, parser output, and tests.

    Features
  • v4.1.0

    v4.1.0 adds support for applying a custom stringification callback to parts of the parsed value inside function expressions. The release notes also mention type improvements, but the code changes include a couple of specific TypeScript signature adjustments that are not spelled out in the notes.

    Features
  • v4.0.3

    v4.0.3 updates the TypeScript type definitions for postcss-value-parser. The main change is widening the typing for the `stringify` API to accept either a single `Node` or an array of `Node`s.

  • v4.0.2

    v4.0.2 updates the number/unit parsing logic to align with CSS Syntax 3 rules for consuming numbers. The release notes only mention a fix for invalid number output from the `unit` helper, but the code changes also alter how certain inputs are split into `number` and `unit`.

  • v4.0.1

    v4.0.1 includes fixes for parsing CSS value strings involving scientific notation signs and for handling division inside calc() without losing surrounding spaces. The code changes primarily affect numeric unit parsing and tokenization rules in the main parser. Additionally, this release adds TypeScript declaration files that are not mentioned in the release notes.

  • v4.0.0

    v4.0.0 adds CSS value parsing support for specific calc() forms and introduces a new unicode-range AST node. It also fixes parsing around empty url() whitespace and rejects invalid values that start with 'e' followed by a digit. The code changes are concentrated in lib/parse.js and lib/unit.js, with the rest of the diff mostly being formatting, test expansion, and tooling updates.

    BreakingFeatures
  • v3.3.0

    This release (v3.3.0) documents a new custom stringify capability that lets callers override how individual AST nodes are stringified. The code diff also shows a behavioral change in the parser’s handling of slash characters, especially around comment parsing, plus some development tooling updates.

    Features
  • v3.2.2

    This release adds support for parsing CSS comments (/* ... */) into the value AST as dedicated `comment` nodes. It also updates `stringify` so that nodes marked as `unclosed` are no longer forcibly closed during serialization.

    BreakingFeatures
  • v3.1.3

    Release v3.1.3 contains almost no release-note content, only a short note thanking contributors for documentation. The actual code changes are in the value parser implementation and add a test for parsing empty url() values, indicating behavior changes to parsing/tokenization rather than just documentation.

  • v3.1.0

    v3.1.0 primarily adds a new `sourceIndex` property to the AST nodes produced by the parser, so consumers can map each node back to its position in the original input string. The test suite and README examples were updated to reflect this additional metadata.

    Features