Skip to content

fsharp/TryFSharp

Folders and files

NameName
Last commit message
Last commit date
Apr 17, 2019
Jun 17, 2019
Oct 6, 2020
Nov 12, 2020
Apr 17, 2019
Feb 12, 2019
Jul 17, 2018
Jul 17, 2018
Sep 26, 2018
Jul 17, 2018
Jul 17, 2018
Apr 17, 2019
Jul 17, 2018
Dec 15, 2018
Apr 19, 2019
Feb 12, 2019
Dec 15, 2018
Apr 17, 2019
Apr 5, 2020

Repository files navigation

Fable REPL

Building locally

To develop the REPL locally, run the WatchApp FAKE target and then open localhost:8080 in your browser.

How to add a sample

To add a sample, you need to add an .fs file to the public/samples/Samples.fsproj project (and a corresponding .html file if necessary), then update public/samples/samples.json. This file is used to generate the samples menu in the browser. This commit is a good example of adding a sample (pun intended).

If you just want to update on the existing samples, you can do it directly using Github UI and send a PR automatically.

You can add three types of entries:

  • Category: Adds a title entry to the menu
  • SubCategory: Adds an entry under a category, and make it collapsible
  • MenuItem: Adds a classic item which when clicked will load the sample into the REPL

Category

{
    "type": "category",
    "label": "Learn Fable",
    "children": [
    ]
}
  • label: Will be displayed as the title of the category
  • children: A list of SubCategory or MenuItem

SubCategory

{
    "type": "sub-category",
    "label": "Interop",
    "children": [
    ]
}
  • label: Will be displayed as the title of the SubCategory
  • children: A list of MenuItem

MenuItem

{
    "type": "menu-item",
    "label": "Basic canvas",
    "fsharpCode": "basic-canvas/basic_canvas.fs",
    "htmlCode": "basic-canvas/basic_canvas.html"
}
  • label: Name to display in the menu item
  • fsharpCode: Relative url of the F# code
  • htmlCode (optional field): Relative url of the html code
  • cssCode (optional field): Relative url of the css code

All the urls for fsharpCode, htmlCode are relative to the public/samples folder.