cssutils – CSS parsing and generation library

cssutils is a library for parsing, manipulating, and generating Cascading Style Sheets (CSS). It provides a document object model for representing stylesheets, allowing applications to inspect and modify CSS rules, selectors, declarations, and property values. The library focuses on processing CSS source code rather than rendering styles or calculating the appearance of web pages.

The library can be used to automate stylesheet maintenance, extract information from CSS documents, and modify existing stylesheets programmatically. Developers can load CSS, navigate its structure, change individual declarations, and serialize the result into valid CSS text. It supports a range of CSS specifications and accommodates many non-standard constructs encountered in existing stylesheets.

This is free and open source software.

Key Features

  • Parse CSS from strings, local files, and URLs.
  • Document object model for accessing stylesheets, rules, declarations, and properties.
  • Modify CSS property names, values, and priorities programmatically.
  • Support for selectors, namespaces, media queries, and imported stylesheets.
  • Parse and manipulate @charset, @import, @media, and @page rules.
  • CSS property validation using configurable profiles.
  • Serialize modified stylesheets with configurable formatting and minification.
  • Handle character encodings when reading and writing stylesheets.
  • Partial support for CSS variables and custom properties.
  • Logging facilities for reporting parsing errors and warnings.
  • Command-line utilities for parsing, combining, and capturing CSS.
  • Support for processing stylesheets containing common non-standard CSS constructs.

Website: github.com/jaraco/cssutils
Support:
Developer: Christof Hoeke, Jason R. Coombs and contributors
License: GNU Lesser General Public License v3.0

cssutils is written in Python. Learn Python 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