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
optionsMonorailCssOptions- MonorailCSS configuration options.
classRegistryIClassRegistry- Live snapshot of classes + generated CSS from the runtime scanner.
loggerILogger<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
optionsMonorailCssOptions- 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
stringPennington.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)
;
}