Skip to content

LightningCss

module LightningCss
AssemblyNacara.Plugin.Assets.LightningCss
Attributes[<RequireQualifiedAccess>]

Compiles the site's CSS for the browsers you name, and minifies it.

Minifying is the half you notice; the other half is Targets. Name the browsers in browserslist syntax and whatever they do not understand is rewritten - nesting flattened, color-mix() computed, prefixes added and unneeded ones dropped - so a theme can be written in modern CSS with no build step of its own.

It applies to every stylesheet the build writes. If the binary cannot be found or fails, the stylesheet ships unchanged and the build says so.

Functions and values

binaryPath (value: string option) (options: LightningCssOptions) : LightningCssOptions

Path of an existing lightningcss binary.

Parameter
valueThe value to use.
optionsThe options so far.
create () : IPlugin

Minify the site's CSS, with the default options.

createWith (configure: LightningCssOptions -> LightningCssOptions) : IPlugin

Minify the site's CSS, configured.

Parameter
configureGiven the defaults, the options to use. Anything it leaves alone keeps its default.
minifyWhileWatching (value: bool) (options: LightningCssOptions) : LightningCssOptions

Minify while watching too.

Parameter
valueThe value to use.
optionsThe options so far.
register (site: Site) : Site

Add CSS minification to a site.

registerWith (configure: LightningCssOptions -> LightningCssOptions) (site: Site) : Site

Add CSS minification to a site, configured.

Parameter
configureGiven the defaults, the options to use. Anything it leaves alone keeps its default.
siteThe site being described.
targets (value: string) (options: LightningCssOptions) : LightningCssOptions

Browsers to compile the CSS for, in browserslist syntax.

Parameter
valueThe value to use.
optionsThe options so far.