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 under /_llms/. 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

MonorailServiceExtensions Pennington.MonorailCss

Extension methods for registering and configuring MonorailCSS services.

Methods

AddMonorailCss

#
public static IServiceCollection AddMonorailCss(IServiceCollection services, Func<IServiceProvider, MonorailCssOptions> optionFactory = null)

Registers MonorailCSS services and the runtime class-discovery pipeline. With no configuration, the discovery pipeline force-loads every non-BCL assembly the app references, scans each one's IL, watches the project's source files in development, and loads wwwroot/app.css as the source CSS prefix when present. The CSS endpoint served by UseMonorailCss regenerates whenever the class set changes.

Parameters

services IServiceCollection
The service collection.
optionFactory Func<IServiceProvider, MonorailCssOptions>
Optional factory for configuring MonorailCSS options.

Returns

IServiceCollection
The service collection for chaining.

UseMonorailCss

#
public static WebApplication UseMonorailCss(WebApplication app, string path = "/styles.css")

Maps the MonorailCSS stylesheet endpoint. The endpoint pulls the current class set from the discovery pipeline registered in AddMonorailCss, generates CSS, and serves it.

Parameters

app WebApplication
The web application.
path string
The URL path for the stylesheet endpoint. Defaults to "/styles.css".

Returns

WebApplication
The web application for chaining.

Pennington.MonorailCss.MonorailServiceExtensions

namespace Pennington.MonorailCss;

/// Extension methods for registering and configuring MonorailCSS services.
public class MonorailServiceExtensions
{
    /// Registers MonorailCSS services and the runtime class-discovery pipeline. With no configuration, the discovery pipeline force-loads every non-BCL assembly the app references, scans each one's IL, watches the project's source files in development, and loads wwwroot/app.css as the source CSS prefix when present. The CSS endpoint served by UseMonorailCss regenerates whenever the class set changes.
    
public static IServiceCollection AddMonorailCss(IServiceCollection services, Func<IServiceProvider, MonorailCssOptions> optionFactory = null)
; /// Maps the MonorailCSS stylesheet endpoint. The endpoint pulls the current class set from the discovery pipeline registered in AddMonorailCss, generates CSS, and serves it.
public static WebApplication UseMonorailCss(WebApplication app, string path = "/styles.css")
; }