CSS Parser Algorithms – CSS parsing library

CSS Parser Algorithms is a library providing algorithms for parsing CSS syntax into structured component values. It implements parsing procedures defined by the CSS Syntax specification and is intended for developers building CSS processors, syntax analysis tools, and other applications that need low-level access to CSS structures.

The library operates on an existing stream of CSS tokens rather than directly accepting raw stylesheet text. It is designed to work with the companion @csstools/css-tokenizer package, which performs the initial tokenization. This separation allows applications to reuse the parsing algorithms when implementing specialised CSS grammars or processing individual sections of a stylesheet. The resulting structures can be inspected and traversed without requiring a complete stylesheet processor.

This is free and open source software.

Key Features

  • Parse individual CSS component values from tokenized input.
  • Parse lists of component values according to the CSS Syntax specification.
  • Support for comma-separated component-value lists.
  • Represent parsed CSS syntax as structured nodes.
  • Handle nested CSS functions and blocks within component values.
  • Integration with @csstools/css-tokenizer for processing CSS token streams.
  • Parser error callbacks for applications requiring diagnostic information.
  • Forgiving parsing behaviour that can continue processing when syntax errors are encountered.
  • Utility for gathering node ancestry within a parsed syntax tree.
  • Tree traversal facilities for inspecting parent and child relationships.
  • Reusable parsing primitives for implementing specialised CSS sub-grammars.

Website: github.com/csstools/postcss-plugins
Support:
Developer: Romain Menke, Antonio Laguna and contributors
License: MIT License

CSS Parser Algorithms is written in TypeScript. Learn TypeScript 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