CodeBrix.StyleSheetParse.MitLicenseForever 1.0.238.81

dotnet add package CodeBrix.StyleSheetParse.MitLicenseForever --version 1.0.238.81
                    
NuGet\Install-Package CodeBrix.StyleSheetParse.MitLicenseForever -Version 1.0.238.81
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CodeBrix.StyleSheetParse.MitLicenseForever" Version="1.0.238.81" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeBrix.StyleSheetParse.MitLicenseForever" Version="1.0.238.81" />
                    
Directory.Packages.props
<PackageReference Include="CodeBrix.StyleSheetParse.MitLicenseForever" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CodeBrix.StyleSheetParse.MitLicenseForever --version 1.0.238.81
                    
#r "nuget: CodeBrix.StyleSheetParse.MitLicenseForever, 1.0.238.81"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CodeBrix.StyleSheetParse.MitLicenseForever@1.0.238.81
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CodeBrix.StyleSheetParse.MitLicenseForever&version=1.0.238.81
                    
Install as a Cake Addin
#tool nuget:?package=CodeBrix.StyleSheetParse.MitLicenseForever&version=1.0.238.81
                    
Install as a Cake Tool

CodeBrix.StyleSheetParse

A fully managed, cross-platform CSS stylesheet parsing library for .NET. CodeBrix.StyleSheetParse has no dependencies other than .NET, and is provided as a .NET 10 library and associated CodeBrix.StyleSheetParse.MitLicenseForever NuGet package.

CodeBrix.StyleSheetParse supports applications and assemblies that target Microsoft .NET version 10.0 and later. Microsoft .NET version 10.0 is a Long-Term Supported (LTS) version of .NET, and was released on Nov 11, 2025; and will be actively supported by Microsoft until Nov 14, 2028. Please update your C#/.NET code and projects to the latest LTS version of Microsoft .NET.

CodeBrix.StyleSheetParse is a fork of the code of the open source ExCSS library - see below for licensing details.

Installation

dotnet add package CodeBrix.StyleSheetParse.MitLicenseForever

Note that the NuGet package ID and the namespace are different - there is no package named plain CodeBrix.StyleSheetParse:

  • NuGet package ID: CodeBrix.StyleSheetParse.MitLicenseForever
  • Assembly and namespace: CodeBrix.StyleSheetParse - i.e. using CodeBrix.StyleSheetParse;

Everything public lives in that one namespace. The package has no NuGet dependencies and no native libraries; it depends only on the .NET base class library. XML documentation (IntelliSense) ships alongside the assembly.

CodeBrix.StyleSheetParse supports:

  • CSS stylesheet parsing from strings and streams
  • Async parsing with cancellation support
  • CSS selector parsing and specificity calculation
  • Style rule, media query, and at-rule modeling
  • @keyframes, @font-face, @supports, @container, @page, @import, @namespace, @charset, @document, @viewport rules
  • Style declaration reading and manipulation
  • CSS serialization (converting parsed stylesheets back to CSS text)
  • Configurable parser tolerance (unknown rules, invalid selectors, comments, etc.)
  • Many more...

CodeBrix.StyleSheetParse is a parser and object model, not a rendering or styling engine. It does not match selectors against a document, compute cascaded or inherited styles, validate CSS against a specification, resolve @import URLs or var() custom properties, or minify CSS. The one built-in formatter emits readable output; implement IStyleFormatter for anything else.

Sample Code

Parse a CSS Stylesheet

using CodeBrix.StyleSheetParse;

var parser = new StylesheetParser();
var stylesheet = parser.Parse("h1 { color: red; font-size: 24px; }");

foreach (var rule in stylesheet.StyleRules)
{
    Console.WriteLine($"Selector: {rule.SelectorText}");
    Console.WriteLine($"Color: {rule.Style.Color}");
}

Parse a CSS Selector and Check Specificity

using CodeBrix.StyleSheetParse;

var parser = new StylesheetParser();
var selector = parser.ParseSelector("div.highlight > span#title");

Console.WriteLine($"Selector: {selector.Text}");
Console.WriteLine($"Specificity: {selector.Specificity}");

Serialize a Stylesheet Back to CSS

using CodeBrix.StyleSheetParse;

var parser = new StylesheetParser();
var stylesheet = parser.Parse("h1 { color: red; } @media screen { p { font-size: 14px; } }");

string css = stylesheet.ToCss();
Console.WriteLine(css);

Documentation

The NuGet package includes AGENT-README.txt, a complete API reference and usage guide written for AI coding agents - point your agent at that file when it is writing code against this library.

Additional sample code and usage examples are available in the CodeBrix.StyleSheetParse.Tests project: https://github.com/ellisnet/CodeBrix.StyleSheetParse/tree/main/tests/CodeBrix.StyleSheetParse.Tests

Note that the test project has InternalsVisibleTo access to the library, so some of what it calls (for example Stylesheet.Rules, MediaRule, SupportsRule, KeyframeRule and parser.ParseDeclaration) is internal and is not available to package consumers.

License

The project is licensed under the MIT License. see: https://en.wikipedia.org/wiki/MIT_License

All code originating from ExCSS was included as allowed by the MIT License permissible open source software license - as of ExCSS version 4.3.1. This project (CodeBrix.StyleSheetParse) complies with all provisions of the source code license of ExCSS v4.3.1 (MIT License).

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on CodeBrix.StyleSheetParse.MitLicenseForever:

Package Downloads
CodeBrix.SvgParse.MsplLicenseForever

A renderer-agnostic SVG document object model (DOM) library for .NET. Provides comprehensive SVG parsing, element modeling, styling, and serialization capabilities. Supports loading SVG documents from files, streams, strings, and XmlReaders, and provides a rich object model for querying and manipulating SVG elements.

CodeBrix.PdfDocCreate.Html2Pdf.MitLicenseForever

Renders author-created HTML pages with CSS styling into PDF documents via the CodeBrix.PdfDocCreate document object model. Applies a documented subset of CSS - inline style attributes, style blocks, and linked local stylesheets - with real selector matching, cascade, specificity, and inheritance. Embeds every image format CodeBrix.Imaging decodes plus SVG (referenced files, data: URIs, and inline svg elements, placed as PDF vector content by default, or rasterized on request - identically on Windows, macOS, and Linux, with no native dependency). All text is rendered with the CodeBrix.Platform.Fonts Roboto (sans-serif), Merriweather (serif), and Roboto Mono (monospace) font packages - plus the Noto companion families they bundle, which extend coverage to polytonic (ancient) Greek, Armenian, Georgian and music notation, and any fonts the consumer registers - so output is identical on every operating system. Designed for HTML/CSS written for PDF generation, not for repurposing arbitrary web pages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.238.81 136 8/26/2026
1.0.165.124 814 6/14/2026
1.0.117 181 4/29/2026
1.0.102 138 4/14/2026