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)
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.
Methods
CreateClassMerger
#public static Func<string, string, string> CreateClassMerger(MonorailCssOptions options)
Builds a fully-configured CssFramework from Pennington's options. Used during DI registration to seed Framework; the discovery pipeline may then rebuild the framework when it processes source CSS.
Parameters
optionsMonorailCssOptions- MonorailCSS options whose framework defines the merge conflicts.
Returns
Func<string, string, string>GetStyleSheet
#public string GetStyleSheet()
Builds the stylesheet from scratch on every call: a fresh CssFramework processes the current class set from GetClasses. This deliberately skips Css (which caches against the framework that was baked into MonorailDiscoveryOptions.Framework at startup). Combined with transient lifetimes on MonorailCssOptions and this service (see MonorailServiceExtensions.AddMonorailCss), edits to ColorScheme, prose customizations, and CustomCssFrameworkSettings flow into the served stylesheet on the next request without a process restart. Pennington is a static content engine — the build is one-shot and the dev server is the only other consumer, so per-call rebuild is the right tradeoff.
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 fully-configured CssFramework from Pennington's options. Used during DI registration to seed Framework; the discovery pipeline may then rebuild the framework when it processes source CSS.
public static Func<string, string, string> CreateClassMerger(MonorailCssOptions options)
;
/// Builds the stylesheet from scratch on every call: a fresh CssFramework processes the current class set from GetClasses. This deliberately skips Css (which caches against the framework that was baked into MonorailDiscoveryOptions.Framework at startup). Combined with transient lifetimes on MonorailCssOptions and this service (see MonorailServiceExtensions.AddMonorailCss), edits to ColorScheme, prose customizations, and CustomCssFrameworkSettings flow into the served stylesheet on the next request without a process restart. Pennington is a static content engine — the build is one-shot and the dev server is the only other consumer, so per-call rebuild is the right tradeoff.
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)
;
}