rrweb-cssom is a JavaScript library providing a CSS parser and a partial implementation of the CSS Object Model (CSSOM). It is primarily used for parsing CSS strings into a structured object representation, enabling programmatic access to CSS rules and styles. The current stable version is 0.8.0. This package is a fork of the original `cssom` project, which its original author declared as unmaintained. `rrweb-cssom`, however, appears to be actively maintained by the `rrweb-io` organization, with recent updates supporting modern CSS features like `@layer`, `@starting-style`, and `@container`. Its release cadence is driven by feature additions and bug fixes from its maintainers. A key differentiator and a limitation is its behavior regarding redundant CSS properties, where later declarations typically overwrite earlier ones, making it unsuitable for certain CSS transformation tasks like minification or linting that require preserving all rules.
npm install rrweb-cssomVerified import paths — ran on the pinned version, not inferred.
Parses a CSS string, logs the structured CSSOM, and demonstrates how to access specific rules and styles, highlighting the property overwrite behavior.
Verify that you are installing `rrweb-cssom` from `@rrweb-io` and not the unmaintained `cssom` package if active development is required.
If your use case requires preserving all CSS declarations, consider using alternative CSS parsers and transformers like PostCSS, csstree, or csso, which are designed for more robust AST manipulation.
Ensure that your target browser environment is IE9+ or a modern browser. If older IE support is absolutely critical, explore polyfills or alternative parsing libraries that do not depend on these features, though supporting such old browsers is generally not recommended for modern web development.
This is intended behavior of the parser. If preserving all declarations (e.g., for browser fallback patterns) is essential, `rrweb-cssom` is not the right tool. Use a dedicated CSS Abstract Syntax Tree (AST) transformer like PostCSS or CSSTree that can preserve and manipulate all declarations.
Upgrade to a modern browser (IE9+ or any other mainstream browser) or adjust your project's browser support matrix. `rrweb-cssom` is designed for modern JavaScript environments.
No dependency data recorded yet.