Table of Contents

Class NiteOptions

Namespace
Nite
Assembly
Nite.dll
public sealed class NiteOptions
Inheritance
NiteOptions
Inherited Members

Properties

ClientConfig

Values for client code, worked out per request when a page is served and read with import { config } from "nite:config". Unlike NITE_PUBLIC_ variables, which are inlined when code is compiled, these come from the running server: settings that differ between environments (an Application Insights connection string, an API's URL), or context about the request (the signed-in user's name, a feature flag). They are serialized as camelCase JSON into the page, so return only what the browser may see.

public Func<HttpContext, object?>? ClientConfig { get; set; }

Property Value

Func<HttpContext, object>

Remarks

MapNiteSpa and the <nite-head /> tag helper write them. Pages that carry them are sent with Cache-Control: private, since they may differ per user.

ClientConfigAsync

Like ClientConfig, for values that take awaiting. Set one or the other.

public Func<HttpContext, Task<object?>>? ClientConfigAsync { get; set; }

Property Value

Func<HttpContext, Task<object>>

CspNonce

The request's Content-Security-Policy nonce, for a policy that allows scripts and styles by nonce. Nite puts it on what it writes into pages (the development import map and scripts, <nite-head />'s scripts), and the development runtime puts it on the <style> elements it creates. Production builds need no inline code, so a policy of 'self' plus the nonce covers both.

public Func<HttpContext, string?>? CspNonce { get; set; }

Property Value

Func<HttpContext, string>

Mode

public NiteMode Mode { get; set; }

Property Value

NiteMode

ProjectDirectory

The folder holding nite.json. Defaults to the content root.

public string? ProjectDirectory { get; set; }

Property Value

string