Skip to content

LiveExamplePreset

type LiveExamplePreset =
    {
        Name: string
        Files: string list
        Css: string option
        Template: string option
        Project: string option
        IsDefault: bool
    }
AssemblyNacara.Plugin.LiveExample

Files put in front of a snippet, so it can use a library without repeating it.

Compiled together with the snippet, so hovering a function defined in a preset gives its real signature and its full name.

Fields

Name: string

What a fence writes to ask for it.

Files: string list

F# files, relative to the project root, in compilation order.

Css: string option

A stylesheet for what its snippets draw.

Unset, the site's own is used - and if there is none either, the frame is left with the browser's defaults.

Template: string option

The page its snippets are run inside.

Unset, the site's own is used. A full HTML document: the import map and the snippet are put into its head and its body, so whatever it lays out is there before the snippet runs.

Project: string option

An F# project whose references and code a snippet can use.

Everything it references and everything it declares reaches the snippets: a site that wants to offer more than one package, or helpers of its own alongside them, writes a project instead of listing packages here.

IsDefault: bool

Whether a fence naming no preset gets this one.

Functions and values

asDefault (preset: LiveExamplePreset) : LiveExamplePreset

The one a fence naming no preset gets.

Say it on one preset: a second default is a build error.

Parameter
presetThe preset so far.
create (name: string) : LiveExamplePreset

A preset a fence can ask for.

Parameter
nameWhat a fence writes: preset=name.
css (value: string) (preset: LiveExamplePreset) : LiveExamplePreset

A stylesheet for what its snippets draw.

Inside the frame only: it never reaches the page around it.

Parameter
valueA CSS file, relative to the project root.
presetThe preset so far.
files (value: string list) (preset: LiveExamplePreset) : LiveExamplePreset

The F# put in front of a snippet, in the order it compiles.

Type-checked on every compile, so keep a preset to the open lines and a helper or two.

Parameter
valueFiles relative to the project root.
presetThe preset so far.
project (value: string) (preset: LiveExamplePreset) : LiveExamplePreset

Give it an F# project, and everything in it reaches the snippets.

The project is compiled once, ahead of time, with every package it references, so a site can offer several libraries and its own helpers together.

It is rebuilt when anything in it changes, with the Fable the browser's compiler was built from, fetched for the purpose.

Parameter
valueThe .fsproj, relative to the project root.
presetThe preset so far.
template (value: string) (preset: LiveExamplePreset) : LiveExamplePreset

The page its snippets run inside.

A full HTML document. The import map and the snippet are put into its head and its body, so whatever it lays out is there before the snippet runs.

Parameter
valueAn HTML file, relative to the project root.
presetThe preset so far.