LiveExamplePreset
type LiveExamplePreset =
{
Name: string
Files: string list
Css: string option
Template: string option
Project: string option
IsDefault: bool
}| Assembly | Nacara.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
Css: string option
Css: string optionA 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
Template: string optionThe 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
Project: string optionAn 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.
Functions and values
asDefault (preset: LiveExamplePreset) : LiveExamplePreset
asDefault (preset: LiveExamplePreset) : LiveExamplePresetThe one a fence naming no preset gets.
Say it on one preset: a second default is a build error.
| Parameter | |
|---|---|
preset | The preset so far. |
create (name: string) : LiveExamplePreset
create (name: string) : LiveExamplePresetA preset a fence can ask for.
| Parameter | |
|---|---|
name | What a fence writes: preset=name. |
css (value: string) (preset: LiveExamplePreset) : LiveExamplePreset
css (value: string) (preset: LiveExamplePreset) : LiveExamplePresetA stylesheet for what its snippets draw.
Inside the frame only: it never reaches the page around it.
| Parameter | |
|---|---|
value | A CSS file, relative to the project root. |
preset | The preset so far. |
files (value: string list) (preset: LiveExamplePreset) : LiveExamplePreset
files (value: string list) (preset: LiveExamplePreset) : LiveExamplePresetThe 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 | |
|---|---|
value | Files relative to the project root. |
preset | The preset so far. |
project (value: string) (preset: LiveExamplePreset) : LiveExamplePreset
project (value: string) (preset: LiveExamplePreset) : LiveExamplePresetGive 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 | |
|---|---|
value | The .fsproj, relative to the project root. |
preset | The preset so far. |
template (value: string) (preset: LiveExamplePreset) : LiveExamplePreset
template (value: string) (preset: LiveExamplePreset) : LiveExamplePresetThe 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 | |
|---|---|
value | An HTML file, relative to the project root. |
preset | The preset so far. |