fable-compiler/Fable

Add more samples to the web site

tpetricek opened this issue · 2 comments

There is a couple of nice samples in the samples folder that are not currently on the web page. Adding a sample to the web page should be fairly easy and it is a fantastic way to learn Fable and contribute at the same time.

I recently added the D3 map and the commit is a good example of what needs to be done (it also does a few bug fixes you can ignore).

  • the d3map.fsx file is a good example of how to write docs (there are a few required things at the top)
  • in docs.fsx, you need to add the folder to the samples

And that is pretty much it - generally, follow what one of the other examples does. After modifying docs.fsx you can run:

./build.sh GenerateDocs
./build.sh BrowseDocs

The first will generate all docs (it compiles all samples, so do this just once). The second one starts local server and updates the samples when you change them. (On windows, use build.cmd)

I had to make a couple of changes to make it work on my machine but after that I just added the three.js tutorial and is like magic! Thanks a lot for your hard work, Tomas!

Just to complete Tomas' explanation:

  • The HTML for the sample will be generated automatically, but you can still keep some parts in the HTML head or body by wrapping the elements as can be seen here and here.
  • The first lines of the fsx script should also contain info for the generation of the HTML: the title, the tagline (or subtitle), the CSS inline style of the container that'll hold the running sample, paths to resolve dependencies (optional) and an intro which comes right below the title.