postcss-value-parser – CSS value parser

postcss-value-parser is a library for parsing and transforming CSS declaration values and at-rule parameters. It converts a CSS value string into a tree of nodes representing its individual components, making it possible to inspect and manipulate values without treating them as unstructured text.

CSS declarations frequently combine keywords, numeric quantities, units, functions, strings, and separators. A property such as background can contain several different value types, while colour and transformation functions introduce additional nesting. postcss-value-parser separates these elements into identifiable nodes that can be traversed and modified independently. Developers can use the library to implement CSS transformations, analyse declarations, and build tools that need to understand the structure of property values.

This is free and open source software.

Key Features

  • Parse CSS declaration values and at-rule parameters into structured node trees.
  • Recognise words, strings, functions, comments, whitespace, and separators.
  • Support for nested CSS functions and their arguments.
  • Parse CSS unicode-range descriptors.
  • Recursive traversal of parsed values using a node-walking API.
  • Modify individual nodes and reconstruct the resulting CSS value.
  • Extract numeric quantities and their associated units.
  • Preserve whitespace and other formatting details during parsing.
  • Source index information identifying the original position of parsed nodes.
  • Support for detecting unclosed strings, comments, and functions.
  • Serialize individual nodes or complete parsed value trees.
  • Custom serialization callbacks for controlling node output.
  • Traversal controls for skipping nested nodes or walking the tree in reverse order.

Website: github.com/postcss/postcss-value-parser
Support:
Developer: Bogdan Chadkin and contributors
License: MIT License

postcss-value-parser is written in JavaScript. Learn JavaScript with our recommended free books and free tutorials.


Related Software

CSS Parsers
PostCSSTransform styles with JavaScript plugins
Lightning CSSParser, transformer, bundler, and minifier
ReworkPlugin framework for CSS preprocessing
PHP CSS ParserPHP library for reading CSS
MenschNon-validating CSS parser
CSSTreeTool set for CSS
StylisLightweight CSS preprocessor
tinycss2CSS parser and generator
ParseGo library offering lexers, parsers, and parsing utilities
LibCSSCSS parser and selection engine
Ruby CSS ParserLoad, parse and cascade CSS rule sets
ParserLibCSS3 SAX-inspired parser
css-parserFork of the cssutils project
ph-cssParse, represent, modify, and write CSS stylesheets
StylecowModern CSS to all browsers
Gonzales PECSS parser which plays nicely with preprocessors
CSSOMCSS parser written in pure JavaScript

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted