This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy at the same URL with .md appended. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

MonorailCssService Pennington.MonorailCss

Wraps the discovery-pipeline output with Pennington's stylesheet prefix (ContentVisibilityRules + ExtraStyles) and serves the result on every /styles.css hit.

Constructors

MonorailCssService

#
public MonorailCssService(MonorailCssOptions options, IClassRegistry classRegistry, ILogger<MonorailCssService> logger)

Wraps the discovery-pipeline output with Pennington's stylesheet prefix (ContentVisibilityRules + ExtraStyles) and serves the result on every /styles.css hit.

Parameters

options MonorailCssOptions
MonorailCSS configuration options.
classRegistry IClassRegistry
Live snapshot of classes + generated CSS from the runtime scanner.
logger ILogger<MonorailCssService>
Emits per-request build timing at Trace.

Methods

CreateClassMerger

#
public static Func<string, string, string> CreateClassMerger(MonorailCssOptions options)

Builds a Tailwind-aware class merge delegate from Pennington's options: (baseClasses, overrideClasses) => merged, dropping utilities in options-rendered baseClasses that conflict with later overrideClasses. Backed by Merge over the same framework the site renders with, so the semantic palette and custom utilities define the conflicts. Consumed by Pennington.UI's ClassMerge so a component's per-instance *Class parameter merges over its variant base through the same framework the site renders with.

Parameters

options MonorailCssOptions
MonorailCSS options whose framework defines the merge conflicts.

Returns

Func<string, string, string>

GetStyleSheet

#
public string GetStyleSheet()

Builds the stylesheet by running the current class set from GetClasses through a cached CssFramework. This deliberately skips Css (which caches against the framework that was baked into MonorailDiscoveryOptions.Framework at startup).

Returns

string

Pennington.MonorailCss.MonorailCssService

namespace Pennington.MonorailCss;

/// Wraps the discovery-pipeline output with Pennington's stylesheet prefix (ContentVisibilityRules + ExtraStyles) and serves the result on every /styles.css hit.
public class MonorailCssService
{
    /// Builds a Tailwind-aware class merge delegate from Pennington's options: (baseClasses, overrideClasses) => merged, dropping utilities in options-rendered baseClasses that conflict with later overrideClasses. Backed by Merge over the same framework the site renders with, so the semantic palette and custom utilities define the conflicts. Consumed by Pennington.UI's ClassMerge so a component's per-instance *Class parameter merges over its variant base through the same framework the site renders with.
    
public static Func<string, string, string> CreateClassMerger(MonorailCssOptions options)
; /// Builds the stylesheet by running the current class set from GetClasses through a cached CssFramework. This deliberately skips Css (which caches against the framework that was baked into MonorailDiscoveryOptions.Framework at startup).
public string GetStyleSheet()
; /// Wraps the discovery-pipeline output with Pennington's stylesheet prefix (ContentVisibilityRules + ExtraStyles) and serves the result on every /styles.css hit.
public MonorailCssService(MonorailCssOptions options, IClassRegistry classRegistry, ILogger<MonorailCssService> logger)
; }